Feat: Add Docker support for web, CLI, and CI with usage documentation#15
Conversation
- Introduces multi-stage Docker setup for efficient builds. - Improves deployment with production-ready image using Nginx. - Seamlessly caches dependencies to speed up the build process. - Optimizes app delivery by ensuring efficient asset caching and fallback mechanisms.
- Introduces a Dockerfile to containerize the CLI application. - Adds a .dockerignore to optimize the build process and prevent unnecessary files from being included. - Sets up a Python environment with caching for dependencies to ensure faster builds.
- Introduces guidelines for using Docker with the web and CLI interfaces. - Enhances user experience by facilitating setup without local dependencies. - Improves documentation with clear examples and commands for translation tasks. - Supports easier environment configuration for translation applications on cloud or local setups.
- Introduces changes to trigger web and CLI jobs only on relevant changes. - Adds Docker build and smoke testing to the CI process. - Optimizes CI efficiency by skipping unrelated tasks for faster feedback.
There was a problem hiding this comment.
Pull request overview
Adds first-class Docker support across the web app and CLI, wires Docker build/smoke tests into CI, and documents Docker-based usage so contributors/users can run the project without local Node/Python toolchains.
Changes:
- Added Docker build artifacts for
web(multi-stage Angular build → nginx runtime) andcli(Python runtime image) plus.dockerignorefiles. - Added an nginx config for SPA routing fallback and static asset caching in the web container.
- Updated CI workflow to path-filter jobs and to build + smoke-test Docker images for web and CLI; expanded README with Docker usage instructions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/nginx.conf | nginx server config for SPA fallback routing and static asset caching. |
| web/Dockerfile | Multi-stage Docker build for Angular app and nginx runtime image. |
| web/.dockerignore | Reduces Docker build context for the web image. |
| cli/Dockerfile | Python-based Docker image for the CLI with pip cache mounts. |
| cli/.dockerignore | Reduces Docker build context for the CLI image. |
| README.md | Adds Docker build/run instructions for web and CLI usage. |
| .github/workflows/ci.yml | Adds path-based job gating plus Docker build + smoke-test jobs and an aggregate CI status job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| docker run --rm -p 8080:80 translora-web | ||
| ``` | ||
|
|
||
| Open http://localhost:8080. The image is a small `nginx:alpine` serving the production Angular build, with SPA-fallback routing pre-configured. |
There was a problem hiding this comment.
README claims the web Docker image is based on nginx:alpine, but web/Dockerfile actually uses nginx:1.27-alpine-slim. This can confuse users trying to reason about image size/behavior; please update the README to match the actual base image (or switch the Dockerfile base image to nginx:alpine if that’s the intent).
| Open http://localhost:8080. The image is a small `nginx:alpine` serving the production Angular build, with SPA-fallback routing pre-configured. | |
| Open http://localhost:8080. The image is a small `nginx:1.27-alpine-slim` serving the production Angular build, with SPA-fallback routing pre-configured. |
| run: | | ||
| set -euo pipefail | ||
| docker run -d --name web-smoke -p 18080:80 translora-web:ci | ||
| for i in {1..15}; do | ||
| curl -fsS -o /dev/null http://localhost:18080/ && break | ||
| sleep 1 | ||
| done | ||
|
|
||
| code=$(curl -s -o /tmp/index.html -w '%{http_code}' http://localhost:18080/) | ||
| [ "$code" = "200" ] || { echo "GET / returned $code"; exit 1; } | ||
| grep -q '<title>TransLora</title>' /tmp/index.html | ||
|
|
||
| # SPA fallback: unknown paths should also return 200 + index.html. | ||
| code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:18080/some/spa/route) | ||
| [ "$code" = "200" ] || { echo "SPA fallback returned $code"; exit 1; } | ||
|
|
||
| docker rm -f web-smoke |
There was a problem hiding this comment.
The docker-web smoke test only removes the web-smoke container at the end of the script. If any earlier command fails (e.g., curl/grep), set -e will exit and the container will be left running, which can leak resources and interfere with later steps. Add an EXIT trap (or use docker run --rm with a background-friendly pattern) to ensure cleanup happens even on failure.
This pull request introduces Docker support for both the CLI and web app, adds automated Docker build and smoke-test jobs to CI, and updates documentation to explain Docker usage. It also includes
.dockerignorefiles to optimize build context and a customnginxconfig for SPA routing. These changes make it easier to build, test, and run the project in isolated environments without installing local dependencies.Docker support and configuration:
Dockerfileand.dockerignorefor bothwebandcli, enabling containerized builds with optimized caching and minimal images. [1] [2] [3] [4]web/nginx.confto provide proper SPA fallback routing and asset caching for the web app in Docker.Continuous Integration (CI) improvements:
.github/workflows/ci.ymlto add jobs that build and smoke-test Docker images for bothwebandcli, and to only run relevant jobs when corresponding files change, improving CI efficiency. [1] [2] [3]Documentation:
README.mdwith detailed instructions and examples for building and running both interfaces via Docker, including volume mounting and host networking tips.