Skip to content

feat: Add automated Docker image building and publishing to GHCR#150

Open
jollySleeper wants to merge 10 commits intozyachel:mainfrom
jollySleeper:feat/docker-optimization
Open

feat: Add automated Docker image building and publishing to GHCR#150
jollySleeper wants to merge 10 commits intozyachel:mainfrom
jollySleeper:feat/docker-optimization

Conversation

@jollySleeper
Copy link
Copy Markdown

🚀 Overview

This PR introduces automated Docker image building and publishing to GitHub Container Registry (GHCR) with multi-architecture support and optimized build performance.

✨ Key Features

🐳 Docker Optimizations

  • Multi-stage build for smaller final images (builder + production stages)
  • Layer caching with package files first for faster builds
  • Security hardening with non-root user and minimal production dependencies
  • Cross-platform support for AMD64 and ARM64 architectures

🔄 CI/CD Pipeline

  • Release-triggered builds - only runs on published GitHub releases
  • Multi-architecture images - supports both Intel/AMD and Apple Silicon
  • Semantic versioning - automatic tagging based on release versions
  • GHCR integration - seamless publishing to GitHub Container Registry

📦 Image Metadata

  • OCI annotations for proper image descriptions and metadata
  • License and source information embedded in container images
  • Professional presentation in GHCR package registry

🛠️ Technical Details

Files Changed:

  • Dockerfile - Multi-stage build with security optimizations
  • .dockerignore - Excludes unnecessary files from build context
  • .github/workflows/release.yml - Automated release pipeline
  • pnpm-lock.yaml - Updated for compatibility

Build Process:

  1. Builder stage: Installs dependencies, builds CSS assets
  2. Production stage: Creates minimal runtime image with non-root user
  3. CI/CD: Builds multi-arch images on releases, pushes to GHCR

🎯 Benefits

  • Faster deployments through optimized build layers
  • Better security with non-root containers and minimal dependencies
  • Broader compatibility with ARM64 support
  • Professional packaging with proper metadata and descriptions
  • Automated releases reducing manual deployment work

🧪 Testing

  • Workflow tested with feature branch builds
  • Multi-architecture builds verified (AMD64 + ARM64)
  • Image metadata properly applied to GHCR

- Exclude development files, dependencies, and documentation
- Reduces build context size and improves build performance
…ments

- Implement multi-stage build to reduce final image size
- Add non-root user for better security
- Use layer caching for faster builds
- Install only production dependencies in final stage
- Use Node LTS Alpine base image
- Build and push multi-arch images (AMD64/ARM64) to GHCR
- Trigger only on published releases for tag-based deployment
- Use semantic versioning for image tags
- Include build caching for faster CI/CD
- Add tag push trigger to test the workflow before merging
- Will be reverted after testing
- Enable workflow on pushes to feat/docker-optimization branch
- Allows testing Docker builds during development
- Remove pnpm-lock.yaml from .dockerignore
- Required for reproducible Docker builds
- Regenerate lockfile with current pnpm version
- Fixes Docker build compatibility issues
- Add title, description, source, and license labels
- Improves discoverability in container registries
- Add OCI annotations to workflow for proper metadata on GHCR
- Fixes missing description in multi-arch container images
- Uses index: prefix for manifest-level annotations
@zyachel zyachel added the type: feature New feature or request label Nov 6, 2025
@zyachel zyachel self-requested a review November 6, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants