-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup the Dockerfile and slim-down container using .dockerignore
- Loading branch information
Lukas Wolfsteiner
committed
Aug 9, 2020
1 parent
7876d7a
commit 551ea7e
Showing
2 changed files
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.vscode/ | ||
.github/ | ||
art/ | ||
bin/ | ||
node_modules/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
# https://hub.docker.com/_/microsoft-dotnet-core | ||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build | ||
WORKDIR /source | ||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env | ||
WORKDIR /app | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY *.csproj ./ | ||
COPY WhatTheFuckShouldLukasHaveForLunch.csproj ./ | ||
RUN dotnet restore | ||
|
||
# copy everything else and build app | ||
COPY . ./ | ||
WORKDIR /source | ||
RUN dotnet publish -c Release -o /app --no-restore | ||
COPY . . | ||
|
||
# publish | ||
RUN dotnet publish -c Release -o out | ||
|
||
# final stage/image | ||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
CMD ASPNETCORE_URLS=http://*:$PORT dotnet WhatTheFuckShouldLukasHaveForLunch.dll | ||
|
||
COPY --from=build-env /app/out . | ||
ENTRYPOINT [ "dotnet", "WhatTheFuckShouldLukasHaveForLunch.dll" ] |