This commit is contained in:
@@ -28,20 +28,23 @@ services:
|
||||
- history-api-project
|
||||
|
||||
migrate:
|
||||
image: migrate/migrate
|
||||
build:
|
||||
context: .
|
||||
dockerfile_inline: |
|
||||
FROM migrate/migrate
|
||||
COPY db/migrations /migrations
|
||||
container_name: history_migrate
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ./assets/resources/.env
|
||||
volumes:
|
||||
- ${PWD}/db/migrations:/migrations:ro
|
||||
entrypoint:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
DB_URL="postgres://$${POSTGRES_USER}:$${POSTGRES_PASSWORD}@db:5432/$${POSTGRES_DB}?sslmode=disable"
|
||||
# Thêm ls để kiểm tra chắc chắn lúc chạy
|
||||
ls /migrations
|
||||
/migrate -path /migrations -database "$$DB_URL" up || \
|
||||
(/migrate -path /migrations -database "$$DB_URL" force 8 && \
|
||||
|
||||
Reference in New Issue
Block a user