This docker image bundles the Go migrate DB migration tool. Extending from this image, you can create one time run containers for running DB migrations for your project.
Simple Dockerfile
for using this image:
FROM wiztools/dbmigrate:3.0.1
COPY db/migrations/*.sql /app/db/migrations/
The version of the image is same as the release version of the migrate tool.
When running the container, you need to pass:
- DB URL
dburl
as environment variable. - The migrate command like
up
/down
as parameter. When no parameter is given, by defaultup
command is used.
Example:
$ docker build -t migrate .
$ docker run -e dburl='mysql://root@tcp(localhost:3306)/test' migrate up