Skip to content

Feat: Add Docker support for web, CLI, and CI with usage documentation#15

Merged
SloMR merged 4 commits into
mainfrom
feat/AddDocker
Apr 26, 2026
Merged

Feat: Add Docker support for web, CLI, and CI with usage documentation#15
SloMR merged 4 commits into
mainfrom
feat/AddDocker

Conversation

@SloMR
Copy link
Copy Markdown
Owner

@SloMR SloMR commented Apr 26, 2026

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 .dockerignore files to optimize build context and a custom nginx config 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:

  • Added Dockerfile and .dockerignore for both web and cli, enabling containerized builds with optimized caching and minimal images. [1] [2] [3] [4]
  • Added web/nginx.conf to provide proper SPA fallback routing and asset caching for the web app in Docker.

Continuous Integration (CI) improvements:

  • Updated .github/workflows/ci.yml to add jobs that build and smoke-test Docker images for both web and cli, and to only run relevant jobs when corresponding files change, improving CI efficiency. [1] [2] [3]

Documentation:

  • Expanded README.md with detailed instructions and examples for building and running both interfaces via Docker, including volume mounting and host networking tips.

SloMR added 4 commits April 26, 2026 22:35
- 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.
@SloMR SloMR self-assigned this Apr 26, 2026
Copilot AI review requested due to automatic review settings April 26, 2026 19:43
@SloMR SloMR merged commit 172a38c into main Apr 26, 2026
9 checks passed
@SloMR SloMR deleted the feat/AddDocker branch April 26, 2026 19:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and cli (Python runtime image) plus .dockerignore files.
  • 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.

Comment thread README.md
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.
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +115 to +131
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
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants