Existing issue
- I have searched the existing issues and found no duplicate.
Problem description
A Compose import ignores a service's env_file:. The variables in that file never reach the container, and the import reports nothing about it.
parseComposeFile (packages/platform/src/engine/lib/compose-parser.ts) never reads svc.env_file. UNSUPPORTED_SERVICE_KEYS has no entry for it either, so collectUnsupported stays silent. That goes against the parser's own rule that a dropped key must not be invisible (#533). Nothing else on the API import path (prepare.service.ts → toProjectInfo → parseComposeFile) fetches the referenced files. Only the .env next to the compose file is read, for interpolation and the opt-in rootEnv rows.
So a common layout deploys with missing configuration:
services:
web:
image: nginx:1.27
env_file: ./config/app.envThe app starts without DATABASE_URL, SECRET_KEY_BASE and so on, and nothing points at env_file as the reason.
The CLI path already behaves differently. openship service sync resolves the file with docker compose config, so the SDK mapper receives the merged environment. The same compose file therefore produces different services depending on whether it is imported from the dashboard or synced from the CLI.
Steps to reproduce
-
Create a repo with this
compose.yml:services: web: image: nginx:1.27 env_file: ./config/app.env api: image: node:22 environment: PORT: "3000" env_file: - path: ./api.env required: falseand
config/app.env:DATABASE_URL=postgres://db/app SECRET_KEY_BASE=abc -
Import it as a Compose project, or call
parseComposeFiledirectly.
Result on main (d60e23fef), from parseComposeFile:
web environment= {}
api environment= {"PORT":"3000"}
unsupported= []Expected, from Docker Compose for the same files (docker compose config --format json, v5.1.4):
web environment= {"DATABASE_URL":"postgres://db/app","SECRET_KEY_BASE":"abc"}
api environment= {"PORT":"3000"} # api.env is absent and required: false, so it is skippedEnvironment
- Openship
mainat d60e23fef (self-hosted, Compose import from a Git repo) - Docker Compose v5.1.4 used for the expected output
Additional context
There are two possible directions, and I'd like a maintainer to pick one before I write a PR:
- Minimal: add
env_filetoUNSUPPORTED_SERVICE_KEYSas a non-blocking warning ("env_file is not read — add these variables to the service's environment"). It's small and honest, but the values still don't arrive. - Fuller: during the scan, read each service's
env_filepaths through the same source reader that already fetches the compose-adjacent.env, relative to the compose file's directory. Merge them belowenvironment:with Compose's precedence, honourrequired: false, and treat values as secrets the wayrootEnvdoes.
One more thing: I couldn't find where the dashboard renders unsupportedCompose from the prepare response. If it isn't shown, option 1 only helps API clients.
Activity
0No activity yet.