Skip to content

Implement MySQL data container support and add test suites across PHP, Node.js, and Python#2

Open
ameliaknowscode wants to merge 2 commits into
dsdobrzynski:mainfrom
ameliaknowscode:main
Open

Implement MySQL data container support and add test suites across PHP, Node.js, and Python#2
ameliaknowscode wants to merge 2 commits into
dsdobrzynski:mainfrom
ameliaknowscode:main

Conversation

@ameliaknowscode

Copy link
Copy Markdown

Summary

  • Implement full data container handling in Node.js and Python, mirroring the existing PHP implementation. Both CLIs now correctly build and run relational (mysql, mariadb, postgres) and non-relational (mongodb, neo4j) database containers with the correct environment variables, port defaults, and optional volume mounts.
  • Fix three bugs in Node.js and Python CLIs discovered during smoke testing:
    • .env lookup now checks the project root first with build/ as a fallback, consistent with the PHP CLI
    • Volume mount env var names corrected to APP_HOST_VOLUME_PATH / APP_CONTAINER_VOLUME_PATH
    • App image build now passes DATA_REL_TYPE and DATA_NONREL_TYPE as build args, so conditional driver/client installation in Dockerfiles (e.g. default-mysql-client, pdo_mysql, pymysql) fires correctly
  • Fix default port bug in PHP CLI: runDataContainer was hardcoded to port 5432 even when MySQL was selected; now defaults to 3306 for mysql/mariadb
  • Add missing volume mount support for data containers in PHP CLI (DATA_REL_HOST_VOLUME_PATH / DATA_REL_CONTAINER_VOLUME_PATH were documented in .env.example but never wired up)
  • Fix import typo in nodejs/commands/build.js (fimportimport)
  • Add test suites for all three implementations: PHPUnit (17 tests), Node.js node:test (24 tests), pytest (26 tests) — covering env var correctness, Dockerfile selection, port defaults, and volume configuration

Test plan

  • PHP unit tests: php vendor/bin/phpunit — 17/17 passing
  • Node.js unit tests: npm test — 24/24 passing
  • Python unit tests: python -m pytest python/tests/ — 26/26 passing
  • PHP + MySQL smoke test: php bin/dapp-bk build against a Laravel 12 app — containers up, DB reachable
  • Node.js + MySQL smoke test: node nodejs/bin/dapp-bk-node.js build — app container serving, /health/db returns MySQL connection OK
  • Python + MySQL smoke test: python -m hig_docker_build_kit.cli build — app container serving, /health/db returns MySQL connection OK

🤖 Generated with Claude Code

ameliaknowscode and others added 2 commits April 17, 2026 04:01
…de.js, and Python

- Refactor PHP BuildCommand: extract buildDataRunCommand, fix default port
  bug (hardcoded 5432 for MySQL), add volume mount support for data containers
- Implement full data container handling in Node.js and Python, mirroring
  the PHP implementation (relational + non-relational, all five DB types)
- Fix import typo in nodejs/commands/build.js (fimport -> import)
- Add PHPUnit test suite (17 tests), Node.js node:test suite (24 tests),
  and pytest suite (26 tests) covering env vars, Dockerfile selection,
  port defaults, and volume configuration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix .env lookup: check project root first, build/ as fallback (was
  only checking build/, inconsistent with PHP implementation)
- Fix volume mount: use APP_HOST_VOLUME_PATH / APP_CONTAINER_VOLUME_PATH
  env var names (was using incorrect APP_VOLUME_HOST / APP_VOLUME_CONTAINER)
- Fix app image build args: pass DATA_REL_TYPE and DATA_NONREL_TYPE so
  conditional driver/client installation in Dockerfiles fires correctly
  (was only passing BASE_IMAGE, leaving mysql client uninstalled)

Found and fixed during Node.js and Python smoke testing against a live
MySQL container.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ameliaknowscode

Copy link
Copy Markdown
Author

This is an overview of what existed already and what I added in this PR:

Language Relational Non-Relational
PHP ✅ Implemented + tested ✅ Implemented, ❌ not unit tested
Node.js ✅ Implemented + tested ✅ Implemented + tested
Python ✅ Implemented + tested ✅ Implemented + tested

The Non-relational tests are only the automated tests, I did not create any test projects to test manually. But MySQL in PHP, Node.js, and Python I did! I also tested with one of the Laravel 12 apps I built, it worked great!

@dsdobrzynski
dsdobrzynski self-requested a review May 5, 2026 16:59
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