Repository containing recipe for sqlx-cli docker image published to Docker Hub. I'm using nix dockerTools to make resulting image as small as possible.
I've made this image to have recent version of sqlx-cli to run migrations with docker compose instead of putting them in my app, which seems like much better workflow.
It's just sqlx-cli packaged into container, so you can refer to https://github.com/launchbadge/sqlx/tree/main/sqlx-cli for additional documentation.
docker run -v ./migrations:/migrations nxyt/sqlx-cli:latest migrate run --database-url=postgres://postgres:[email protected]:5432/postgres
migrate:
image: nxyt/sqlx-cli
# optional if you want to wait till database containers is ready to accept connections
# depends_on:
# db:
# condition: service_healthy
command: migrate run
volumes:
- ./migrations:/migrations
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable
nix
docker
nix build .
docker load -i result
# image is available as sqlx-cli:latest
Content type
Image
Digest
sha256:84d39831c…
Size
23.8 MB
Last updated
about 3 years ago
docker pull nxyt/sqlx-cli