mirror of
https://github.com/xorcare/testing-go-code-with-postgres.git
synced 2024-12-24 16:28:34 +02:00
34 lines
953 B
YAML
34 lines
953 B
YAML
version: "3.8"
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15.3-alpine3.18
|
|
command: postgres -c 'max_connections=1000'
|
|
environment:
|
|
POSTGRES_DB: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_MULTIPLE_DATABASES: reference
|
|
healthcheck:
|
|
test: pg_isready --username "postgres" --dbname "reference"
|
|
interval: 1s
|
|
retries: 5
|
|
timeout: 5s
|
|
ports:
|
|
- "32260:5432"
|
|
volumes:
|
|
- ./docker-multiple-databases.sh:/docker-entrypoint-initdb.d/docker-multiple-databases.sh:ro
|
|
tmpfs:
|
|
- /var/lib/postgresql/data:rw # Necessary to speed up integration tests.
|
|
|
|
migrate:
|
|
image: migrate/migrate:v4.16.2
|
|
command: >
|
|
-source 'file:///migrations'
|
|
-database 'postgresql://postgres:postgres@postgres:5432/reference?sslmode=disable' up
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./migrations:/migrations:ro
|