# syntax=docker/dockerfile:1 # ---- build ---- FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build WORKDIR /src # Restore first so the package layer is cached until the project file changes. COPY forge/forge.csproj forge/ RUN dotnet restore forge/forge.csproj COPY forge/ forge/ RUN dotnet publish forge/forge.csproj -c Release -o /app --no-restore -p:UseAppHost=false # ---- runtime ---- FROM mcr.microsoft.com/dotnet/aspnet:11.0 AS runtime # Forge runs the git executable for everything (needs 2.40+; it checks at startup). RUN apt-get update \ && apt-get install -y --no-install-recommends git ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY --from=build /app . # Data folder owned by the image's non-root user, so a fresh named volume inherits that ownership. RUN mkdir -p /data && chown $APP_UID:$APP_UID /data VOLUME /data ENV ASPNETCORE_URLS=http://+:8080 \ ASPNETCORE_ENVIRONMENT=Production \ ASPNETCORE_FORWARDEDHEADERS_ENABLED=true \ Forge__DataPath=/data USER $APP_UID EXPOSE 8080 ENTRYPOINT ["dotnet", "forge.dll"]