diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 45bf497..b7bcdaf 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 67c1f62..26f5130 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 && \