This project aims to be an easy way to do migrations for you withou resorting to ORMs, just plain old SQL files.
The following variables are available to configure the image:
Considering your current project has a path that contain the sql files named migrations/sql/*.sql (follow flyway sql files convention). Then your docker-compose.yml file could look something like this:
data:
image: debian:jessie
volumes:
- .:/var/www/html
migrations:
image: rdccosmo/flywaydb
volumes_from:
- data
links:
- db
environment:
- DATABASE_NAME=dbname
- DATABASE_USER=dbuser
- DATABASE_PASSWORD=dbpass
- DATABASE_PORT=3306
- DATABASE_ENCODING=utf8
- DATABASE_DRIVER=mysql
- MIGRATIONS_PATH=/var/www/html/migrations/sql
php:
build: php:5.6-fpm
volumes_from:
- data
links:
- db
ports:
- "80:80"
db:
build: rdccosmo/mysql
ports:
- "3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=dbuser
- MYSQL_PASSWORD=dbpass
- MYSQL_DATABASE=dbname
OBS: the script that runs the migrations expects a database instance with name db, so if you name your database instance with a different name than db, remember to create a label mapping to db, like this:
links:
mydb:db
Content type
Image
Digest
sha256:3b9cfd8b9…
Size
211.7 MB
Last updated
over 8 years ago
docker pull rdccosmo/flywaydb