Files
DailyMeals/MealPlan.Api/Dockerfile
2026-06-24 22:02:52 +02:00

28 lines
700 B
Docker

# ---------- Build stage ----------
FROM mcr.microsoft.com/dotnet/sdk:10.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:10.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"]