Last active
October 20, 2022 23:31
-
-
Save farukcan/9b966d8c01962fd76fcfcddcd05f33ce to your computer and use it in GitHub Desktop.
111MB dotnet core 6.0 alpine docker file
This file contains hidden or 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
| FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build | |
| WORKDIR /source | |
| COPY /. ./ | |
| # Install npm - we need node_modules folder | |
| RUN apk add --update nodejs npm | |
| RUN npm install | |
| # Build the app | |
| RUN dotnet restore | |
| RUN dotnet build -c Release | |
| RUN dotnet publish -c Release -o /output | |
| # we need fast and lightweight runtime | |
| FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS runtime | |
| # Copy builds - we need fast app! | |
| COPY --from=build /output . | |
| COPY --from=build /source/node_modules ./node_modules | |
| # Run the app - NOTE: Do not forget ENVs | |
| EXPOSE 80/tcp | |
| ENTRYPOINT ["./NameOfYourAppHere"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment