-
Notifications
You must be signed in to change notification settings - Fork 0
chore(infra): Add Docker Image CI workflow #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@Jerry080401 存取 GET /openapi.json 會回 500,導致整個 smoke-test 失敗。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive Docker Image CI workflow that builds and tests the application stack using Docker Compose. The changes introduce automated testing of both frontend and backend services with health checks and smoke tests.
- Adds a GitHub Actions workflow for building and testing Docker images
- Enhances Docker Compose configuration with health check dependencies
- Updates the frontend Dockerfile to include curl for health checks
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
.github/workflows/docker-build.yml | Adds comprehensive CI workflow with build, health checks, and smoke tests |
docker-compose.yml | Updates service dependencies to use health check conditions and adds frontend health check |
frontend/Dockerfile | Installs curl package for health check functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
echo "Waiting for services to become ready..." | ||
docker compose -f docker-compose.yml ps | ||
# Wait for backend health endpoint with retries | ||
MAX_RETRIES=30 |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers should be made configurable or documented. Consider defining these as environment variables or adding comments explaining the chosen values (60 seconds total wait time).
MAX_RETRIES=30 | |
MAX_RETRIES=30 | |
# Wait 2 seconds between retries; total wait time is MAX_RETRIES * SLEEP = 60 seconds |
Copilot uses AI. Check for mistakes.
docker compose -f docker-compose.yml exec -T backend sh -c "curl -sS -o /dev/null -w '%{http_code}' http://nginx:80 || true" || true | ||
docker compose -f docker-compose.yml exec -T backend sh -c "curl -sS -o /dev/null -w '%{http_code}' http://backend:8000/health || true" || true |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated docker compose exec pattern. Consider extracting this into a shell function to reduce code repetition and improve maintainability.
Copilot uses AI. Check for mistakes.
echo "Smoke tests passed" | ||
|
||
- name: Tear down compose | ||
if: always() |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'always()' condition may mask failures in previous steps. Consider using 'if: failure()' or 'if: cancelled()' to only run cleanup when needed.
if: always() | |
if: failure() || cancelled() |
Copilot uses AI. Check for mistakes.
No description provided.