refactor: optimize Dockerfiles for quicker builds
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2020-12-05 22:28:19 +01:00
parent 6af240c922
commit 60586f4d68
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 10 additions and 11 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
bin/
obj/

View File

@ -1,15 +1,14 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-alpine
COPY . /src
WORKDIR /src
RUN dotnet --version && dotnet --info
COPY *.csproj ./
RUN dotnet restore
RUN dotnet clean
RUN dotnet build -c Release
COPY . ./
RUN dotnet build -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:2.1
COPY --from=0 /src/bin/Release/netcoreapp2.1/publish/ App/
WORKDIR /App
COPY --from=0 /src/out .
ENV ASPNETCORE_ENVIRONMENT=Release
ENTRYPOINT ["dotnet", "pwt-0x01-ng.dll"]

View File

@ -1,12 +1,10 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-alpine
COPY . /src
WORKDIR /src
RUN dotnet --version && dotnet --info
COPY *.csproj ./
RUN dotnet restore
RUN dotnet clean
COPY . ./
RUN dotnet build -c Debug
ENV ASPNETCORE_ENVIRONMENT=Development