Skip to content

Add Docker containerization with GitHub Actions CI/CD pipeline#15

Draft
Copilot wants to merge 6 commits into
mainfrom
copilot/setup-container-registry-pipeline
Draft

Add Docker containerization with GitHub Actions CI/CD pipeline#15
Copilot wants to merge 6 commits into
mainfrom
copilot/setup-container-registry-pipeline

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 28, 2025

Implements automated Docker image builds and deployment to GitHub Container Registry (GHCR) with CI/CD pipeline.

Docker Images

Backend (backend/Dockerfile)

  • Multi-stage build: Node 20 build → slim production image
  • Auto-removes circular "backend": "file:" dependency during build
  • Non-root user, health check, ~200MB final size

Frontend (frontend/Dockerfile)

  • Multi-stage build: Node 20 build → nginx:alpine serve
  • SPA routing configured, health check, ~50MB final size

Both exclude package-lock.json via .dockerignore to avoid circular dependency errors.

GitHub Actions Workflow

.github/workflows/docker-build-push.yml triggers on:

  • Push to main/develop → build amd64, push to GHCR
  • Version tags (v*.*.*) → build amd64+arm64, push to GHCR
  • Pull requests → build only, no push
  • Manual dispatch

Tagging strategy: latest, {branch}, {sha}, v{major}.{minor}.{patch}

Uses GitHub Actions cache for ~10x faster rebuilds.

Local Development

docker-compose.yml provides complete stack:

services:
  mongo:     # MongoDB with persistent volume
  backend:   # Connects to mongo, requires JWT_SECRET in .env
  frontend:  # nginx serving React app

Quick start:

cp .env.example .env    # Set JWT_SECRET (required)
docker-compose up -d

Container Registry

Images available at:

  • ghcr.io/codingf0x/chat-app/backend:latest
  • ghcr.io/codingf0x/chat-app/frontend:latest

Documentation

  • QUICKSTART.md - 5-minute setup guide
  • DOCKER.md - Complete deployment reference
  • README.md - Updated with Docker section
Original prompt

How to setup container registry which create an image off docker file from my file and push it to the container registry?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits December 28, 2025 19:25
- Create Dockerfiles for backend (NestJS) and frontend (React/Vite)
- Add .dockerignore files to optimize builds
- Create GitHub Actions workflow to build and push images to GHCR
- Add comprehensive Docker deployment documentation
- Handle circular dependency issues in package.json during builds

Co-authored-by: CodingF0X <79570460+CodingF0X@users.noreply.github.com>
- Add docker-compose.yml for easy local development
- Add .env.example template for environment variables
- Update DOCKER.md with docker-compose usage instructions
- Configure health checks for all services
- Add MongoDB service with persistent volumes

Co-authored-by: CodingF0X <79570460+CodingF0X@users.noreply.github.com>
- Add QUICKSTART.md with step-by-step Docker setup instructions
- Update README.md with Docker deployment section
- Add references to Docker documentation
- Document container registry usage

Co-authored-by: CodingF0X <79570460+CodingF0X@users.noreply.github.com>
- Fix frontend/.dockerignore to include vite.config.ts (required for build)
- Update docker-compose.yml to use environment variable for JWT_SECRET
- Add Linux-specific MongoDB connection instructions in QUICKSTART.md
- Add comment clarifying wget availability in nginx:alpine

Co-authored-by: CodingF0X <79570460+CodingF0X@users.noreply.github.com>
- Make multi-platform builds conditional (only on version tags) for faster CI
- Remove default JWT_SECRET from docker-compose.yml for better security
- Update DOCKER.md to emphasize JWT_SECRET requirement
- Add command to generate secure JWT_SECRET

Co-authored-by: CodingF0X <79570460+CodingF0X@users.noreply.github.com>
Copilot AI changed the title [WIP] Setup container registry to create and push Docker images Add Docker containerization with GitHub Actions CI/CD pipeline Dec 28, 2025
Copilot AI requested a review from CodingF0X December 28, 2025 19:33
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