Three new Dockerfiles, each producing a minimal runtime image based on mcr.microsoft.com/dotnet/aspnet:10.0: - Dockerfile.runtime : Yavsc.Org (port 5000 HTTP) - Dockerfile.runtime.blogs : Yavsc.Blogs (port 5004 HTTP) - Dockerfile.runtime.api : Yavsc.Api (port 5002 HTTP) Each one: 1. COPY --from=pazof/yavsc-build-env:debian12-dotnet10-android36-v1 /app/publish/<project>/ — i.e. the artifacts produced by the publish step added in the previous commit. 2. Injects appsettings-org.json via BuildKit secret mount (--mount=type=secret,id=yavsc_appsettings). The secret never lands in a layer — BuildKit copies it into /app and discards the mount. 3. Sets ASPNETCORE_URLS to the project's HTTP port and exposes it. 4. Adds a HEALTHCHECK that pings the root URL. HTTPS (ports 5001, 5003, 5005) is intentionally NOT exposed in the Dockerfile: enabling it requires mounting /etc/letsencrypt (typically via docker-compose) and configuring Kestrel:Certificates in appsettings-org.json. The compose file in the next commit documents the volume mount pattern.
34 lines
1.2 KiB
Text
34 lines
1.2 KiB
Text
# Image runtime pour Yavsc.Blogs (backend API headless des blogs,
|
|
# destiné à être déployé sur un sous-domaine dédié en production —
|
|
# cf. doc/architecture/decoupage-organisation.md).
|
|
#
|
|
# Cf. Dockerfile.runtime pour le pattern appsettings-org.json via
|
|
# BuildKit secret mount, et le montage optionnel /etc/letsencrypt
|
|
# pour HTTPS en production.
|
|
#
|
|
# docker build \
|
|
# --secret id=yavsc_appsettings,src=./appsettings-org.json \
|
|
# -f Dockerfile.runtime.blogs \
|
|
# -t yavsc-blogs:dev .
|
|
|
|
# syntax=docker/dockerfile:1.7
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
ARG BUILD_ENV_IMAGE=pazof/yavsc-build-env:debian12-dotnet10-android36-v1
|
|
COPY --from=${BUILD_ENV_IMAGE} /app/publish/Yavsc.Blogs/ ./
|
|
|
|
RUN --mount=type=secret,id=yavsc_appsettings,dst=/run/secrets/yavsc_appsettings \
|
|
cp /run/secrets/yavsc_appsettings /app/appsettings-org.json \
|
|
&& chmod 0644 /app/appsettings-org.json
|
|
|
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
ENV ASPNETCORE_URLS=http://+:5004
|
|
|
|
EXPOSE 5004
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD wget --quiet --spider http://localhost:5004/ || exit 1
|
|
|
|
ENTRYPOINT ["dotnet", "Yavsc.Blogs.dll"]
|