The purposed of this docker image is to create a super tiny image for running migrations. It is predominantly a wrapper for goose, the migration cli built in Golang.
It is built on top of Alpine with the latest stable release of goose and bash installed.
It is recommended to build your own migration images from this one with an entrypoint to execute everything. This is to ensure the same migrations can be run in your environments.
project
|_ ...
|_migrations
| |_001_init.sql
| |_002_add-new-thing.sql
| |_Dockerfile
|_ ...
FROM gomicro/goose
ADD *.sql /migrations/
ADD entrypoint.sh /migrations/
ENTRYPOINT ["/migrations/entrypoint.sh"]
#!/bin/bash
DBSTRING="host=$DBHOST user=$DBUSER password=$DBPASSWORD dbname=$DBNAME sslmode=$DBSSL"
goose postgres "$DBSTRING" up
See goose's documentation for SQL Migrations on how to structure the migration files.
The image will be versioned following the stable releases of goose. Only the patch version may change in order to force updates to the docker image. See the releases section for the latest version.
See LICENSE.md for more information.