Skip to content

Commit

Permalink
edit Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeleedev committed Oct 27, 2023
1 parent 4ae6701 commit 0d7b129
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
32 changes: 32 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/engine/reference/builder/#dockerignore-file

**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /TodoApi
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
COPY . /source
WORKDIR \source\TodoApi

# Copy everything
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /TodoApi
COPY --from=build-env /App/out .
ENTRYPOINT ["dotnet", "TodoApi.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS final
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "TodoApi.dll"]

0 comments on commit 0d7b129

Please sign in to comment.