https://github.com/gomicro/docker-goose
Docker image for https://github.com/pressly/goose
https://github.com/gomicro/docker-goose
build-tool docker docker-image hacktoberfest migration-tool
Last synced: 3 months ago
JSON representation
Docker image for https://github.com/pressly/goose
- Host: GitHub
- URL: https://github.com/gomicro/docker-goose
- Owner: gomicro
- License: mit
- Created: 2017-09-05T05:41:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-10-29T16:26:17.000Z (8 months ago)
- Last Synced: 2025-10-29T18:24:14.285Z (8 months ago)
- Topics: build-tool, docker, docker-image, hacktoberfest, migration-tool
- Language: Dockerfile
- Size: 17.6 KB
- Stars: 18
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker goose
[](https://github.com/gomicro/docker-goose/actions/workflows/build.yml)
[](https://github.com/gomicro/docker-goose/blob/master/LICENSE.md)
[](https://github.com/gomicro/docker-goose/releases/latest)
The purposed of this docker image is to create a super tiny image for running migrations. It is predominantly a wrapper for [goose](https://github.com/pressly/goose), the migration cli built in Golang.
It is built on top of Alpine with the latest stable release of goose and bash installed.
# Usage
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
|_ ...
```
### Dockerfile
```
FROM gomicro/goose
ADD *.sql /migrations/
ADD entrypoint.sh /migrations/
ENTRYPOINT ["/migrations/entrypoint.sh"]
```
### Entrypoint
```
#!/bin/bash
DBSTRING="host=$DBHOST user=$DBUSER password=$DBPASSWORD dbname=$DBNAME sslmode=$DBSSL"
goose postgres "$DBSTRING" up
```
### Migrations
See goose's documentation for [SQL Migrations](https://github.com/pressly/goose#sql-migrations) on how to structure the migration files.
# Versioning
The image will be versioned following the stable releases of [goose](https://github.com/pressly/goose). Only the patch version may change in order to force updates to the docker image. See the [releases](https://github.com/gomicro/forge/releases) section for the latest version.
# License
See [LICENSE.md](./LICENSE.md) for more information.