init
Some checks failed
Build and Release / release (push) Failing after 1m32s

This commit is contained in:
2026-03-25 22:47:09 +07:00
parent 9bc2200455
commit 21dd86c3ea
2 changed files with 24 additions and 27 deletions

View File

@@ -25,7 +25,6 @@ jobs:
run: | run: |
docker system prune -a --volumes -f docker system prune -a --volumes -f
- name: Build and restart containers - name: Deploy to Container
run: | run: |
# Đảm bảo file .env tồn tại trước khi chạy docker compose --env-file ./assets/resources/.env up -d --build --remove-orphans
docker compose --env-file ./assets/resources/.env up -d --build

View File

@@ -28,30 +28,28 @@ services:
- history-api-project - history-api-project
migrate: migrate:
image: migrate/migrate image: migrate/migrate
container_name: history_migrate container_name: history_migrate
depends_on: depends_on:
db: db:
condition: service_healthy condition: service_healthy
env_file: env_file:
- ./assets/resources/.env - ./assets/resources/.env
volumes: volumes:
- ./db/migrations:/migrations # Sử dụng đường dẫn tuyệt đối biến docker tự hiểu hoặc đảm bảo folder tồn tại
# Sử dụng sh -c để có thể chạy chuỗi lệnh - ./db/migrations:/migrations:ro
entrypoint: entrypoint:
- sh - sh
- -c - -c
- | - |
# Lấy URL database từ biến môi trường DB_URL="postgres://$${POSTGRES_USER}:$${POSTGRES_PASSWORD}@db:5432/$${POSTGRES_DB}?sslmode=disable"
DB_URL="postgres://$${POSTGRES_USER}:$${POSTGRES_PASSWORD}@db:5432/$${POSTGRES_DB}?sslmode=disable" # Thêm ls để debug xem có file không nếu vẫn lỗi
ls /migrations
echo "Checking for dirty database..." /migrate -path /migrations -database "$$DB_URL" up || \
/migrate -path /migrations -database "$$DB_URL" up || \ (/migrate -path /migrations -database "$$DB_URL" force 8 && \
(echo "Database is dirty, forcing to version 8..." && \ /migrate -path /migrations -database "$$DB_URL" up)
/migrate -path /migrations -database "$$DB_URL" force 8 && \ networks:
/migrate -path /migrations -database "$$DB_URL" up) - history-api-project
networks:
- history-api-project
app: app:
build: . build: .
container_name: history_app container_name: history_app