Skip to content

fix(docker): fix 5 bugs in Shevek's PHP 8.2 Docker setup - #470

Open
Neophytis wants to merge 3 commits into
masterfrom
fix/master-docker-entrypoint-bugs
Open

fix(docker): fix 5 bugs in Shevek's PHP 8.2 Docker setup#470
Neophytis wants to merge 3 commits into
masterfrom
fix/master-docker-entrypoint-bugs

Conversation

@Neophytis

Copy link
Copy Markdown
Contributor

Summary

Fixes 5 bugs introduced in commit 901b23a ("Make master work on php8.2 and update docker setup accordingly"):

  • Security: Remove DB credential echo from entrypoint — the debug echo "new PDO(...)" line printed the full database password to docker logs on every container start
  • Production DOA: Add env-var fallbacks after .env grep — composer dump-env prod deletes .env in the production image, causing all five credential variables to be empty strings; the PDO wait loop then fails for 300s and exits 1, making production containers unbootable
  • Migrations silently skipped: Fix path src/Migrations/Migrations/ in entrypoint — src/Migrations/ does not exist; the condition always evaluated false
  • Migrations absent from image: Add COPY Migrations Migrations/ to Dockerfile — migration files were not copied into the production image at all
  • CI testing wrong PHP version: Update all 11 jobs from php-version: 7.4 to 8.2, and the Behat MariaDB service from 10.1.41 to 12.0.2 to match the Dockerfile

Test plan

  • Build the production image: docker build --target bewelcome_php -t bewelcome/app .
  • Verify no credentials appear in container logs: docker logs <container> should not contain any PDO connection strings
  • Verify migrations run on a fresh container start with APP_ENV=prod and DB credentials passed as env vars (not via .env)
  • Verify Migrations/ directory is present in the built image: docker run --rm --entrypoint sh bewelcome/app -c 'ls Migrations/'
  • CI passes on PHP 8.2

Peter Alexandre added 3 commits August 4, 2026 16:44
- Remove DB credential echo from entrypoint (password was printed to
  docker logs on every container start)
- Add env-var fallbacks after .env grep so prod containers can start:
  composer dump-env prod deletes .env, causing the PDO wait loop to
  fail for 300s then exit 1 with empty credentials
- Fix migrations path: src/Migrations/ does not exist; actual dir is
  Migrations/ at repo root (migrations were silently skipped)
- Add COPY Migrations Migrations/ to Dockerfile (files were absent
  from the production image entirely)
- Update CI from PHP 7.4 to 8.2 and MariaDB 10.1.41 to 12.0.2
- actions/checkout v2 → v4
- actions/cache v1 → v4 (was blocking all jobs on run)
- actions/upload-artifact v2 → v4
- actions/setup-node v2-beta → v4
- Replace deprecated set-output syntax with GITHUB_OUTPUT
Following the pattern already used in develop's build-image.yml.
SHA pins prevent supply chain attacks via tag mutation.

- actions/checkout v4.2.2  → 9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- actions/cache v4         → 0057852bfaa89a56745cba8c7296529d2fc39830
- actions/upload-artifact v4.6.2 → 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
- actions/setup-node v4    → 49933ea5288caeca8642d1e84afbd3f7d6820020
- shivammathur/setup-php v2 → f3e473d116dcccaddc5834248c87452386958240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant