Skip to content

Docker - #364

Open
mirmirmirr wants to merge 53 commits into
v0.5.0from
docker
Open

Docker#364
mirmirmirr wants to merge 53 commits into
v0.5.0from
docker

Conversation

@mirmirmirr

@mirmirmirr mirmirmirr commented Jul 4, 2026

Copy link
Copy Markdown
Member

In light of live updates and for other future development changes, docker might be better for maintaining easy reproducibility of our code. This PR set up a docker ecosystem for the project (frontend, backend, Redis), plus the Make commands, CI workflows, and docs needed to support it.

Docker Images

  • ./backend/Dockerfile - production image (non-root user, Uvicorn).
  • ./frontend/Dockerfile - multi-stage production build using Next.js standalone output.
  • ./backend/Dockerfile.dev - dev image, used by docker-compose
  • ./frontend/Dockerfile.dev - dev image (npm run dev), used by docker-compose
    .dockerignore - like .gitignore

Docker Compose

docker-compose.yml defines frontend, backend, and redis services, wired together over the Docker network, with bind mounts for hot-reloading and named volumes (redis_data, node_modules, next_cache) to avoid reinstalling/rebuilding on every restart.

Make Commands

Added a Makefile wrapping common workflows: up, build, down, restart, log streaming, container shells, and running/creating Django migrations. Run make help for the full list. This was meant to make the developer experience a little smoother. Ideally, all you would need to remember are these make commands.

CI/CD

  • publish-images.yml- builds and pushes both images to GHCR on pushes to main/version branches, multi-platform (amd64/arm64) with GHA build caching.
  • clean-up.yml-weekly scheduled job to prune old images from the registry, keeping the most recent few.
  • merge-protect.yml - gates PRs into main to version branches only, and checks that the branch name matches frontend/package.json's version.

Docs

Updated the root README.md with a proper Docker setup section (services overview, quick start, trimmed Make command table).

Added ./docs/docker.md with a deeper explanation of the architecture, image build strategy, Compose file, CI workflows, and a "Known Gaps" section for follow-up work.

@mirmirmirr
mirmirmirr marked this pull request as ready for review July 25, 2026 15:03
@mirmirmirr
mirmirmirr requested a review from Copilot July 25, 2026 15:07
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change adds Docker and Compose support for local frontend, backend, and Redis development, including image definitions, startup scripts, configurable service URLs, persistent volumes, and Makefile helpers. It adds multi-platform GHCR publishing, weekly image retention cleanup, and pull request version validation workflows. Frontend version metadata is updated, network URL discovery is added, and README and Docker documentation describe setup, commands, architecture, and current Compose limitations.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 19


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f57daeaf-bbb1-4740-8638-945ebab0d00a

📥 Commits

Reviewing files that changed from the base of the PR and between 1c91c59 and 6cdd712.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (20)
  • .github/workflows/clean-up.yml
  • .github/workflows/merge-protect.yml
  • .github/workflows/publish-images.yml
  • Makefile
  • README.md
  • backend/.dockerignore
  • backend/Dockerfile
  • backend/Dockerfile .dev
  • backend/api/settings.py
  • backend/start.sh
  • docker-compose.yml
  • docs/docker.md
  • frontend/.dockerignore
  • frontend/Dockerfile
  • frontend/Dockerfile.dev
  • frontend/next.config.ts
  • frontend/package.json
  • frontend/src/lib/utils/api/server-fetch.ts
  • frontend/start.sh
  • scripts/print-ip.js

Comment thread .github/workflows/clean-up.yml
Comment thread .github/workflows/clean-up.yml
Comment thread .github/workflows/merge-protect.yml Outdated
Comment thread .github/workflows/publish-images.yml Outdated
Comment thread .github/workflows/publish-images.yml Outdated
Comment thread frontend/Dockerfile.dev
Comment thread frontend/src/lib/utils/api/server-fetch.ts Outdated
Comment thread Makefile Outdated
Comment thread Makefile
Comment thread Makefile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a Docker-based local development ecosystem (frontend, backend, Redis) plus supporting developer tooling (Make targets), CI workflows for publishing/retaining images, and documentation updates to standardize setup and improve reproducibility across contributors.

Changes:

  • Adds Docker Compose stack and Dockerfiles for frontend/backend, plus .dockerignore files to keep build contexts small.
  • Adds a Makefile and helper scripts to simplify common Docker workflows (up/build/down/logs/shell/migrations).
  • Adds GitHub Actions workflows for image publishing, merge protection, and registry cleanup; updates docs/README for the new workflow.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
scripts/print-ip.js Adds a helper script to print network-accessible URLs for local dev.
README.md Expands root documentation with Docker + Make-based quick start and project overview.
Makefile Introduces Make targets wrapping Docker Compose workflows and URL printing.
frontend/start.sh Adds a container entrypoint script for dev startup.
frontend/src/lib/utils/api/server-fetch.ts Updates server-side API base URL selection to support Docker internal networking.
frontend/package.json Bumps frontend version (used by release/branch/versioning workflows).
frontend/package-lock.json Updates lockfile version fields to match the new package.json version.
frontend/next.config.ts Adjusts dev rewrite destination to use INTERNAL_API_URL when present.
frontend/Dockerfile.dev Adds a frontend development image build definition.
frontend/Dockerfile Adds a multi-stage frontend production image using Next.js standalone output.
frontend/.dockerignore Adds frontend Docker build context exclusions.
docs/docker.md Adds detailed documentation of the Docker architecture, workflows, and known gaps.
docker-compose.yml Defines the Compose stack (frontend/backend/redis), volumes, and Docker-network env wiring.
backend/start.sh Adds a backend dev startup script (deps/migrations/uvicorn reload).
backend/Dockerfile .dev Adds a backend dev Dockerfile (note: filename currently includes a space).
backend/Dockerfile Adds a backend production Dockerfile (non-root user).
backend/api/settings.py Makes Redis URLs configurable via environment variables for Docker compatibility.
backend/.dockerignore Adds backend Docker build context exclusions.
.github/workflows/publish-images.yml Adds CI workflow to build/push images to GHCR.
.github/workflows/merge-protect.yml Adds merge gating + package-version-vs-branch-name enforcement for releases.
.github/workflows/clean-up.yml Adds scheduled pruning of old container images in GHCR.
Files not reviewed (1)
  • frontend/package-lock.json: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/print-ip.js Outdated
Comment thread Makefile
Comment thread Makefile Outdated
Comment thread Makefile
Comment thread docker-compose.yml
Comment thread backend/Dockerfile Outdated
Comment thread .github/workflows/merge-protect.yml
Comment thread frontend/src/lib/utils/api/server-fetch.ts Outdated
Comment thread docs/docker.md
Comment thread .github/workflows/merge-protect.yml
@mirmirmirr
mirmirmirr requested a review from jzgom067 August 2, 2026 14:26
Comment thread Makefile
Comment on lines +90 to +91
migrate:
docker compose exec backend python manage.py migrate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any way to add arguments to this command? Such that I can specify a number, and it will run the migration with it as an argument.

For example, if I run make migrate 0027, it should run python manage.py migrate api 0027.

  • This is used for unapplying migrations when switching to an older version.

Comment on lines +29 to +41
skip-tags: v*.*.*
dry-run: false

- name: Clean up Plancake Backend images
uses: snok/container-retention-policy@d3bdcf5ce9b05f685154e4a16c39233b245e3d53 # v3.1.0
with:
account: plan-cake
token: ${{ secrets.GITHUB_TOKEN }}
image-names: plancake-backend
cut-off: 1w
timestamp-to-use: updated_at
keep-n-most-recent: 3
skip-tags: v*.*.*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

By specifying skip-tags to match all version branch containers, aren't they going to be kept forever? Or is that your intention?

@jzgom067 jzgom067 added this to the v0.5.0 milestone Aug 4, 2026
@jzgom067 jzgom067 added the dev Related to development operations label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev Related to development operations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants