TotalMerchandise / docker-doctrine-migrations

Standalone Docker image to perform Doctrine Migrations by simply mounting the migrations folder as a volume & passing in the database configuration as environment variables.

Home Page:https://www.totalmerchandise.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Doctrine Migrations

A simple Docker image that allows Doctrine Migrations to be executed as a standalone step in a CI Pipeline (such as GitHub Actions or GitLab CI).

Example usage

docker pull ghcr.io/totalmerchandise/docker-doctrine-migrations:main
docker run \
  -v $(pwd)/app/src/Migrations:/data \
  -e MIGRATION_DRIVER=pdo_mysql \
  -e MIGRATION_DATABASE=my_database_name \
  -e MIGRATION_USERNAME=my_username \
  -e MIGRATION_PASSWORD=my_password \
  -e MIGRATION_HOSTNAME=my_database_host \
  ghcr.io/totalmerchandise/docker-doctrine-migrations:main \
  migrations:migrate

Breakdown

  • Migrations are in the folder app/src/Migrations (relative to the current working directory)
  • We connect to the database using the pdo_mysql driver
  • The database name is 'my_database_name'
  • We have database read/write access as the user 'my_username'
  • The password for 'my_username' is 'my_password'
  • The database is reachable at the hostname 'my_database_host'
  • I wish to run the command 'migrations:migrate'

For additional commands referer to the official Doctrine Migrations Documentation

About

Standalone Docker image to perform Doctrine Migrations by simply mounting the migrations folder as a volume & passing in the database configuration as environment variables.

https://www.totalmerchandise.co.uk

License:MIT License


Languages

Language:Dockerfile 86.0%Language:PHP 14.0%