Initial commit
This commit is contained in:
27
MealPlan.Api/Dockerfile
Normal file
27
MealPlan.Api/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# ---------- Build stage ----------
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Restore first to leverage Docker layer caching.
|
||||
COPY ["MealPlan.Api.csproj", "./"]
|
||||
RUN dotnet restore "MealPlan.Api.csproj"
|
||||
|
||||
COPY . .
|
||||
RUN dotnet publish "MealPlan.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# ---------- Runtime stage ----------
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
|
||||
WORKDIR /app
|
||||
|
||||
# Run as the non-root user shipped in the aspnet image.
|
||||
USER $APP_UID
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:5000 \
|
||||
ASPNETCORE_ENVIRONMENT=Production \
|
||||
DOTNET_RUNNING_IN_CONTAINER=true
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
ENTRYPOINT ["dotnet", "MealPlan.Api.dll"]
|
||||
Reference in New Issue
Block a user