-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Demo #2
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
base: main
Are you sure you want to change the base?
Docker Demo #2
Conversation
…d of host script)
This reverts commit 4f63408.
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 eliminates the dependency on host-side bash scripts by enabling the Docker demo to run entirely within Docker containers using native Docker Compose commands. It also introduces automated CI testing via GitHub Actions to verify the demo pipeline works correctly.
Key changes:
- Replaced custom
run_demo.shwrapper with direct Docker Compose commands - Added GitHub Actions workflow to automatically test the Docker demo in CI
- Enhanced docker-compose.yml with profiles for different use cases (db-only, external database)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| docker/demo/docker-compose.yml | Refactored service names, added db-only profile, updated entrypoints to handle line endings and permissions at runtime, improved documentation |
| docker/demo/demo_entrypoint.sh | Changed shebang to #!/usr/bin/env bash and modified error handling to support minimal environments |
| docker/demo/README.md | Updated all examples to use direct Docker Compose commands instead of wrapper script |
| .github/workflows/docker-demo.yaml | Added new CI workflow to build, run, and validate the Docker demo with comprehensive error handling |
| condition: service_healthy | ||
| working_dir: /app | ||
| entrypoint: ["/bin/bash", "/app/docker/demo/demo_entrypoint.sh"] | ||
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] |
Copilot
AI
Dec 15, 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 bash -lc in the entrypoint is unusual and potentially problematic. The -l flag makes bash run as a login shell, which sources profile files and can introduce unexpected behavior or side effects. Unless login shell behavior is specifically required, use bash -c instead for more predictable execution.
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] | |
| entrypoint: ["/bin/bash", "-c", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] |
| docker exec ggmpilot-demo-db bash -lc "\ | ||
| set -euo pipefail;\ | ||
| psql -U postgres -d demo -v ON_ERROR_STOP=1 -c 'SELECT count(*) AS client_rows FROM silver.client;' \ | ||
| || psql -U postgres -d demo -v ON_ERROR_STOP=1 -c 'SELECT count(*) AS client_rows FROM silver."CLIENT";';\ | ||
| " |
Copilot
AI
Dec 15, 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.
The validation step uses bash -lc to run commands inside the container, which is inconsistent with the use of bash (without -l) elsewhere in the workflow. The login shell flag (-l) is unnecessary here and can introduce unexpected behavior from profile files. Use bash -c for consistency and more predictable execution.
| set -euo pipefail | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo errexit |
Copilot
AI
Dec 15, 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.
The syntax set -euo errexit is incorrect because -e is already the short form of errexit. This line should be set -eu (since pipefail is set separately on line 7 with fallback). The current form mixes the short flag -e with the long option name errexit, which is redundant and may cause unexpected behavior.
| set -euo errexit | |
| set -eu |
| condition: service_healthy | ||
| working_dir: /app | ||
| entrypoint: ["/bin/bash", "/app/docker/demo/demo_entrypoint.sh"] | ||
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] |
Copilot
AI
Dec 15, 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.
The entrypoint uses sed to remove carriage returns and chmod to make the script executable. However, this approach is fragile because it processes the file at runtime on every container start. A better approach would be to ensure the file has correct line endings in the repository (via .gitattributes) and set execute permissions in the Dockerfile. This runtime workaround suggests the root cause (Windows line endings) should be fixed at the source.
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] | |
| entrypoint: ["/app/docker/demo/demo_entrypoint.sh"] |
| run: | | ||
| docker pull postgres:16 | ||
| docker pull python:3.12-slim | ||
| docker pull ghcr.io/astral-sh/uv:latest || true |
Copilot
AI
Dec 15, 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.
The workflow uses docker pull ghcr.io/astral-sh/uv:latest || true which silently ignores pull failures. While this might be intentional for cache warmup, it could mask network issues or repository access problems. Consider logging when the pull fails to make troubleshooting easier.
| docker pull ghcr.io/astral-sh/uv:latest || true | |
| docker pull ghcr.io/astral-sh/uv:latest || echo "WARNING: Failed to pull ghcr.io/astral-sh/uv:latest (non-fatal)" |
| image: ${DEMO_APP_IMAGE:-ggmpilot:demo} | ||
| build: | ||
| context: ../.. | ||
| dockerfile: Dockerfile |
Copilot
AI
Dec 15, 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.
The image is specified after the build section, but Docker Compose best practice is to specify image before build. While this works, the conventional order is to define the image name first, then the build context. This makes it clearer what image will be created.
| - external | ||
| working_dir: /app | ||
| entrypoint: ["/bin/bash", "/app/docker/demo/demo_entrypoint.sh"] | ||
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] |
Copilot
AI
Dec 15, 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 bash -lc in the entrypoint is unusual and potentially problematic. The -l flag makes bash run as a login shell, which sources profile files and can introduce unexpected behavior or side effects. Unless login shell behavior is specifically required, use bash -c instead for more predictable execution.
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] | |
| entrypoint: ["/bin/bash", "-c", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] |
| - external | ||
| working_dir: /app | ||
| entrypoint: ["/bin/bash", "/app/docker/demo/demo_entrypoint.sh"] | ||
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] |
Copilot
AI
Dec 15, 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.
The entrypoint uses sed to remove carriage returns and chmod to make the script executable. However, this approach is fragile because it processes the file at runtime on every container start. A better approach would be to ensure the file has correct line endings in the repository (via .gitattributes) and set execute permissions in the Dockerfile. This runtime workaround suggests the root cause (Windows line endings) should be fixed at the source.
| entrypoint: ["/bin/bash", "-lc", "sed -i 's/\r$//' /app/docker/demo/demo_entrypoint.sh && chmod +x /app/docker/demo/demo_entrypoint.sh && /app/docker/demo/demo_entrypoint.sh"] | |
| entrypoint: ["/bin/bash", "-lc", "/app/docker/demo/demo_entrypoint.sh"] |
| image: ${DEMO_APP_IMAGE:-ggmpilot:demo} | ||
| build: | ||
| context: ../.. | ||
| dockerfile: Dockerfile |
Copilot
AI
Dec 15, 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.
The image is specified after the build section, but Docker Compose best practice is to specify image before build. While this works, the conventional order is to define the image name first, then the build context. This makes it clearer what image will be created.
| docker exec ggmpilot-demo-db psql -U postgres -d demo -v ON_ERROR_STOP=1 -c "\ | ||
| SELECT table_schema, table_name\ | ||
| FROM information_schema.tables\ | ||
| WHERE table_schema IN ('source','staging','silver')\ | ||
| ORDER BY 1,2;\ |
Copilot
AI
Dec 15, 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.
The bash command embeds SQL that spans multiple lines within the docker exec command. The backslashes and line continuation make this hard to read and maintain. Consider extracting the SQL query to a variable or using a here-document for better readability.
| docker exec ggmpilot-demo-db psql -U postgres -d demo -v ON_ERROR_STOP=1 -c "\ | |
| SELECT table_schema, table_name\ | |
| FROM information_schema.tables\ | |
| WHERE table_schema IN ('source','staging','silver')\ | |
| ORDER BY 1,2;\ | |
| docker exec ggmpilot-demo-db bash -c "psql -U postgres -d demo -v ON_ERROR_STOP=1 <<'EOF' | |
| SELECT table_schema, table_name | |
| FROM information_schema.tables | |
| WHERE table_schema IN ('source','staging','silver') | |
| ORDER BY 1,2; | |
| EOF |
- Used shared test helpers more consistently - Centralized port assignment to avoid conflicts
- Used shared test helpers more consistently - Centralized port assignment to avoid conflicts - Improve retry behaviour in get_connection
- Used shared test helpers more consistently - Centralized port assignment to avoid conflicts - Improve retry behaviour in get_connection
- Used shared test helpers more consistently - Centralized port assignment to avoid conflicts - Improve retry behaviour in get_connection
f0630f6 to
4fd500a
Compare
Makes Docker demo run fully in Docker + add automated test to verify Docker demo works