-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
64 lines (48 loc) · 2.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
ARG REPO=mcr.microsoft.com/dotnet/core/runtime-deps
FROM $REPO:3.0-alpine3.9 AS build-env
# Disable the invariant mode (set in base image)
RUN apk add --no-cache icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8
# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 3.0.100-preview6-012264
RUN wget -O dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-musl-x64.tar.gz \
&& dotnet_sha512='c130bf9cf4e05071200762686590da138b9cde32bdf209c8d659a6ac250554ab0d190f6b5327e618bcd85c1f35192ba197940fe5de01b8498185cfeee6bc84f4' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -C /usr/share/dotnet -xzf dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
&& rm dotnet.tar.gz
# Enable correct mode for dotnet watch (only mode supported in a container)
ENV DOTNET_USE_POLLING_FILE_WATCHER=true \
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
NUGET_XMLDOC_MODE=skip
# Trigger first run experience by running arbitrary cmd
RUN dotnet help
# Install PowerShell global tool
ENV POWERSHELL_VERSION 6.2.1
RUN wget -O PowerShell.Linux.Alpine.$POWERSHELL_VERSION.nupkg https://pwshtool.blob.core.windows.net/tool/$POWERSHELL_VERSION/PowerShell.Linux.Alpine.$POWERSHELL_VERSION.nupkg \
&& powershell_sha512='0cbed2f335a5b3fee907c4c4c67521bf96b753a61bb842975793644ed9f69f2b82d459fd3778086e980aa681a0d44d2523ee429c288e7cc0c0623cb200c3fa3a' \
&& echo "$powershell_sha512 PowerShell.Linux.Alpine.$POWERSHELL_VERSION.nupkg" | sha512sum -c - \
&& mkdir -p /usr/share/powershell \
&& dotnet tool install --add-source / --tool-path /usr/share/powershell --version $POWERSHELL_VERSION PowerShell.Linux.Alpine \
&& rm PowerShell.Linux.Alpine.$POWERSHELL_VERSION.nupkg \
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
# To reduce image size, remove the copy nupkg that nuget keeps.
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm \
# Add ncurses-terminfo-base to resolve psreadline dependency
&& apk add --no-cache ncurses-terminfo-base
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
#EXPOSE 5000
#ENV ASPNETCORE_URLS=http://*:5000
#ENV ASPNETCORE_URLS=http://+:5000
# Build runtime image
CMD ASPNETCORE_URLS=http://*:$PORT dotnet /app/out/ASPDotNetCore3Crawl.dll
#ENTRYPOINT ["dotnet", "/app/out/ASPDotNetCore3Crawl.dll"]