yavsc/Dockerfile.runtime.api
Paul Schneider ab37c5403a docker: hardcode BUILD_ENV_IMAGE tag in COPY --from=
'COPY --from=${BUILD_ENV_IMAGE}' is rejected by BuildKit:
  failed to solve: failed to parse stage name "${BUILD_ENV_IMAGE}":
    invalid reference format: repository name
    (library/${BUILD_ENV_IMAGE}) must be lowercase

A COPY --from= can only reference either a local stage of the
same Dockerfile, or a static image reference. ARG interpolation
in the stage name is not supported.

Replace the ARG + interpolation with the pinned tag in all
three Dockerfile.runtime* files. Bumping the build-env image
now means updating Dockerfile, Dockerfile.backend, and the three
Dockerfile.runtime* in lockstep.
2026-06-27 16:26:39 +01:00

32 lines
1.1 KiB
Text

# Image runtime pour Yavsc.Api (API REST JSON principale, consommée
# par les clients headless : PostIt, intégrations tierces, etc.).
#
# 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.api \
# -t yavsc-api:dev .
# syntax=docker/dockerfile:1.7
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
COPY --from=pazof/yavsc-build-env:debian12-dotnet10-android36-v1 /app/publish/Yavsc.Api/ ./
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://+:5002
EXPOSE 5002
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD wget --quiet --spider http://localhost:5002/ || exit 1
ENTRYPOINT ["dotnet", "Yavsc.Api.dll"]