A small two-container app: a FastAPI + PyMuPDF backend and a Next.js frontend
that proxies /api/pdf/* to it. Images are built and published to Docker Hub
by .github/workflows/publish-api.yml and publish-web.yml on every push to
master/main that touches backend/ or frontend/.
There are two builds: one for local dev (built from ./backend and
./frontend source), and one for prod (pulled from Docker Hub). After
building either, start/stop/manage the containers in Docker Desktop.
Uses docker-compose.dev.yml as an override to build api and web from
source:
docker compose -f docker-compose.yml -f docker-compose.dev.yml buildThis produces pdf-tools-api:local and pdf-tools-web:local.
Uses docker-compose.yml alone, which pulls the published images instead of
building. Set DOCKERHUB_USERNAME to the account the images are published
under (either export it, or put it in a .env file next to
docker-compose.yml):
export DOCKERHUB_USERNAME=your-dockerhub-username
docker compose buildThis pulls DOCKERHUB_USERNAME/pdf-tools-api:latest and
DOCKERHUB_USERNAME/pdf-tools-web:latest.
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -dAdd --build to rebuild first (equivalent to running the build command above
before up). Tail logs and stop with:
docker compose -f docker-compose.yml -f docker-compose.dev.yml logs -f
docker compose -f docker-compose.yml -f docker-compose.dev.yml downdocker compose up -dDOCKERHUB_USERNAME must be set (env var or .env file) as in the build step
above. Tail logs and stop with:
docker compose logs -f
docker compose downOnce running (either mode), the app is at http://localhost:8080. The api
service has a health check, so web won't start until the API is ready;
docker compose ps shows current status.
Each push to master/main touching backend/** or frontend/** triggers
publish-api.yml / publish-web.yml, which call the reusable
docker-publish.yml workflow to build and push:
DOCKERHUB_USERNAME/pdf-tools-apiDOCKERHUB_USERNAME/pdf-tools-web
tagged with latest (on the default branch), the commit SHA, and any git
tag. These are exactly what docker-compose.yml pulls.