This commit is contained in:
@@ -17,14 +17,6 @@ jobs:
|
||||
mkdir -p assets/resources
|
||||
printf "%s" "${{ secrets.ENV_FILE }}" > assets/resources/.env
|
||||
|
||||
- name: Stop and remove old containers
|
||||
run: |
|
||||
docker compose down || true
|
||||
|
||||
- name: Remove unused Docker resources
|
||||
run: |
|
||||
docker system prune -a --volumes -f
|
||||
|
||||
- name: Deploy to Container
|
||||
run: |
|
||||
docker compose --env-file ./assets/resources/.env up -d --build --remove-orphans
|
||||
@@ -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