27 lines
816 B
Text
27 lines
816 B
Text
# https://hub.docker.com/_/microsoft-dotnet-core
|
|
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
|
|
WORKDIR /source
|
|
|
|
# copy csproj and restore as distinct layers
|
|
COPY *.sln .
|
|
COPY aspnetapp/*.csproj ./aspnetapp/
|
|
RUN dotnet restore -r linux-musl-x64
|
|
|
|
# copy everything else and build app
|
|
COPY aspnetapp/. ./aspnetapp/
|
|
WORKDIR /source/aspnetapp
|
|
RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained false --no-restore
|
|
|
|
# final stage/image
|
|
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
|
|
WORKDIR /app
|
|
COPY --from=build /app ./
|
|
|
|
# See: https://github.com/dotnet/announcements/issues/20
|
|
# Uncomment to enable globalization APIs (or delete)
|
|
#ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false
|
|
#RUN apk add --no-cache icu-libs
|
|
#ENV LC_ALL en_US.UTF-8
|
|
#ENV LANG en_US.UTF-8
|
|
|
|
ENTRYPOINT ["./aspnetapp"]
|