https://github.com/sanders41/sqlx-migration-runner
Docker container to run sqlx migrations
https://github.com/sanders41/sqlx-migration-runner
docker docker-compose migrations sqlx
Last synced: 3 days ago
JSON representation
Docker container to run sqlx migrations
- Host: GitHub
- URL: https://github.com/sanders41/sqlx-migration-runner
- Owner: sanders41
- License: mit
- Created: 2025-09-22T12:45:48.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2026-03-17T00:58:55.000Z (4 months ago)
- Last Synced: 2026-05-02T20:39:23.820Z (2 months ago)
- Topics: docker, docker-compose, migrations, sqlx
- Language: Shell
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# sqlx-cli docker image to run migrations
Currently only supports PostgreSQL. Make sure to mount the local `migrations` directory to the
`migrations` directory in the contnainer.
## Example docker-compose.yml
```yaml
services:
db:
image: postgres:18-alpine
restart: unless-stopped
container_name: db
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
expose:
- 5432
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
volumes:
- db-data:/var/lib/postgresql/data
migrations:
image: ghcr.io/sanders41/sqlx-migration-runner:latest
container_name: migrations
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
- POSTGRES_HOST=db
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
depends_on:
db:
condition: service_healthy
restart: true
volumes:
- ./migrations:/migrations
volumes:
db-data:
```
## How To Pull The container
```sh
docker pull ghcr.io/sanders41/sqlx-migration-runner:latest
```