Fix Portainer deploy: use variable substitution instead of env_file

This commit is contained in:
2026-09-04 13:30:21 -07:00
parent a0eec98839
commit 50424acad1
3 changed files with 15 additions and 4 deletions

View File

@@ -18,7 +18,9 @@ Repo: `https://primegit.primecontrols-dev.com/m.mabrey/sde-meeting-toolkit.git`
## Step 2: Set environment variables
`.env` is not in the repo on purpose; it holds secrets and is listed in `.gitignore`. Portainer's stack editor has its own **Environment variables** section, below the repository settings. Add each of these as a name and value pair.
`.env` is not in the repo on purpose; it holds secrets and is listed in `.gitignore`. `docker-compose.yml` reads each setting through `${VARIABLE_NAME}` substitution instead of a literal `env_file`, so it works whether the value comes from a real `.env` next to the file (local and Docker Desktop use) or from Portainer's own stack settings (Git-pull use, where no `.env` file exists).
Portainer's stack editor has its own **Environment variables** section, below the repository settings. Add each of these as a name and value pair.
| Name | Value |
|---|---|
@@ -32,7 +34,7 @@ Repo: `https://primegit.primecontrols-dev.com/m.mabrey/sde-meeting-toolkit.git`
| `TOKEN_USAGE_FILE` | `./data/token-usage.json` |
| `MOCK_AI` | `false` |
Portainer writes these into a real `.env` file inside the stack's own directory on the host when it deploys. `docker-compose.yml` reads that same file (`env_file: - .env`), so nothing else needs to change for this to work.
Portainer passes these to Compose as substitution values for the `${VARIABLE_NAME}` references in `docker-compose.yml`. No `.env` file needs to exist on the host for this to work.
## Step 3: Deploy