docker-compose: explicit source/target mapping for build secrets

The shorthand 'secrets: - yavsc_appsettings' relies on Compose
v2 to derive both source and target from the same name. In
some BuildKit integrations this is not enough — the secret id
seen inside the Dockerfile (yavsc_appsettings) and the source
defined at top-level (yavsc_appsettings, file: ...) end up not
being mapped correctly, leading to:

  cp: cannot stat '/run/secrets/yavsc_appsettings':
    No such file or directory

at the blogs-runtime / api-runtime / web-runtime stages.

Use the explicit long form:

  secrets:
    - source: yavsc_appsettings
      target: yavsc_appsettings

in all three runtime services. source is the top-level secret
name (file: ./src/Yavsc.Org/appsettings-org.json); target is
the id BuildKit exposes inside the container at
/run/secrets/yavsc_appsettings, matching --mount=type=secret,
id=yavsc_appsettings in the Dockerfile.
This commit is contained in:
Paul Schneider 2026-06-27 18:25:26 +01:00
commit 4b4afa2eae

View file

@ -28,7 +28,8 @@ services:
args:
BUILD_ENV_TAG: debian12-dotnet10-android36-v1
secrets:
- yavsc_appsettings
- source: yavsc_appsettings
target: yavsc_appsettings
env_file: .env
# ASPNETCORE_URLS forcé à HTTP seul en dev. Le HTTPS (port 5001)
# est désactivé par défaut parce qu'aucun certificat n'est
@ -74,7 +75,8 @@ services:
args:
BUILD_ENV_TAG: debian12-dotnet10-android36-v1
secrets:
- yavsc_appsettings
- source: yavsc_appsettings
target: yavsc_appsettings
env_file: .env
# ASPNETCORE_URLS forcé à HTTP seul en dev. Voir commentaire détaillé
# dans le service `web` ci-dessus ; même logique pour l'API.
@ -105,7 +107,8 @@ services:
args:
BUILD_ENV_TAG: debian12-dotnet10-android36-v1
secrets:
- yavsc_appsettings
- source: yavsc_appsettings
target: yavsc_appsettings
env_file: .env
# ASPNETCORE_URLS forcé à HTTP seul en dev. Voir commentaire détaillé
# dans le service `web` ci-dessus ; même logique pour les blogs.