Created
March 14, 2022 01:05
-
-
Save ScriptBytes/65cc845993f70c66380aea45b7af2acb to your computer and use it in GitHub Desktop.
A simple dockerfile for a .net core 6 API
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-env | |
# Copy csproj and restore as distinct layers | |
COPY ./TodoAPI/TodoAPI.csproj ./TodoAPI/TodoAPI.csproj | |
COPY *.sln . | |
RUN dotnet restore | |
# Copy everything else and build | |
COPY . ./ | |
RUN dotnet publish -c Release -o build --no-restore | |
FROM mcr.microsoft.com/dotnet/aspnet:6.0 | |
WORKDIR /app | |
COPY --from=build-env ./build . | |
ENV ASPNETCORE_URLS=http://*:8080 | |
EXPOSE 8080 | |
ENTRYPOINT [ "dotnet", "TodoAPI.dll" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment