A docker image for flyway command-line tool.
The image integrates with wait-for-it script, because docker-compose does not wait for dependency container available. Refer to the article "Controlling startup order in Compose".
docker build --build-arg FLYWAY_VERSION=4.2.0 -t <image-name:tag> .
The build argument FLYWAY_VERSION
is optional, which defaults to 4.2.0.
Refer to the docker-compose.yml
.
Execute docker-compose up
.
The ENTRYPOINT
locates at /opt/bin/entrypoint.sh
. You could change the default behaviors by mounting your entrypoint.sh
file, or use --entrypoint
option with docker
command.
The CMD
locates at /opt/bin/cmd.sh
. You could change the default behaviors by mounting your cmd.sh
file, or overwrite it with docker
command.
Use docker-compose.yml
for example: docker-compose run flyway flyway info
flyway
could be referenced in $PATH
.
- Required
- DB_HOST
- DB_PORT
- DB_USER
- DB_PWD
- DATABASE
- WAIT_HOST: Same to
DB_HOST
in general - WAIT_PORT: Same to
DB_PORT
in general
- Optional
- url: Defaults to
jdbc:mysql://"$DB_HOST":"$DB_PORT"/"$DATABASE"
- locations: Defaults to
filesystem:$SQL_DIR,classpath:$JAVA_DIR
- SQL_DIR: Defaults to
/home/app/sql
- JAVA_DIR: Defaults to
/home/app/java
- SQL_DIR: Defaults to
- WAIT_OPTS: Defaults to
-s
. More options refer to wait-for-it - WAIT_TIMEOUT: Defaults to
30
, count in seconds.
- url: Defaults to
You can set these environment variables via docker run -e
.
The default flyway.conf is here. It change the flyway default behaviors.
You could mount yours on /home/app/src/flyway.conf
.
You should mount your migration files on /home/app/sql
for SQL migrations and /home/app/java
for Java migrations.
docker-compose run --rm flyway /bin/bash
Copyright (c) 2017 ADoyle. The project is licensed under the Apache License Version 2.0.
See the LICENSE file for the specific language governing permissions and limitations under the License.
See the NOTICE file distributed with this work for additional information regarding copyright ownership.