Skip to content

Conversation

Copy link

Copilot AI commented Dec 9, 2025

This PR adds production-ready Docker containerization and automated CI/CD via GitHub Actions for the HapMap project.

Changes Made

Docker Setup

  • Multi-stage Dockerfile using node:22-alpine for minimal image size
  • nginx reverse proxy for efficient static asset delivery with aggressive caching
  • Pre-compression with gzip and brotli to minimize bundle sizes
  • Production-only dependencies in final image to reduce size
  • Health checks and proper signal handling for container orchestration
  • Documentation added in DOCKER.md with setup instructions

GitHub Actions Workflow

  • Automated testing on all pull requests (runs Astro checks and builds)
  • Docker image building with multi-platform support and layer caching
  • Automatic push to GitHub Container Registry (ghcr.io) on main branch
  • pnpm support respecting .npmrc node version configuration

Architecture

Since the project uses Keystatic CMS which requires server-side rendering, the implementation uses:

  • nginx serving static assets directly with 1-year cache expiration
  • Node.js server handling dynamic requests and Keystatic admin routes
  • This provides SPA-like performance while maintaining SSR capabilities

Environment Variables

No new environment variables needed - the container uses HOST=127.0.0.1 and PORT=4321 internally.

Testing

  • ✅ Astro checks pass
  • ✅ Build process completes successfully
  • ✅ Code review completed with all feedback addressed
  • ✅ Security scan passed with no vulnerabilities
  • ✅ Docker configuration validated

The setup follows Docker and containerization best practices with optimized image sizes and efficient resource usage.

Original prompt

Can you make this projects ready for hosting using docker. So add a GithubAction for testting/building a docker container/pushing it to github.

Try to keep the docker container small if posible.
The backend wil use postgress as a database and whitenoise for the static (use uv to install that if needed)

If you add new env settings please also add them to the .env.example


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Matthijz98
Copy link
Owner

@copilot Can you make this project ready for hosting using docker. So add a GithubAction for testting/building a docker container/pushing it to github.

Try to keep the docker container small if posible.
For the front-end deploy it as a SPA using nginx. And use things as pre-compressing to keep the size of the bundle small. The front-end uses pnpm as a package maneger and for using the correct node version.

If you add new env settings please also add them to the .env.example

Copy link
Author

Copilot AI commented Dec 9, 2025

@copilot Can you make this project ready for hosting using docker. So add a GithubAction for testting/building a docker container/pushing it to github.

Try to keep the docker container small if posib...

I've completed the Docker and GitHub Actions setup for the HapMap project. Here's what was implemented:

Docker Setup:

  • ✅ Multi-stage Dockerfile using node:22-alpine for minimal image size
  • ✅ nginx reverse proxy serving static assets directly for optimal performance
  • ✅ Pre-compression with gzip and brotli to reduce bundle sizes
  • ✅ Production dependencies only in final image

GitHub Actions:

  • ✅ Workflow with separate test and docker jobs
  • ✅ Tests run on all PRs (checks + build)
  • ✅ Docker images built and pushed to GitHub Container Registry on main branch
  • ✅ Build caching for faster workflow runs
  • ✅ Uses pnpm and respects .npmrc node version

Architecture Note:
Since the project uses Keystatic CMS which requires SSR, I kept it in server mode with nginx as a reverse proxy (rather than pure static SPA). nginx serves static assets directly with aggressive caching, while dynamic requests are proxied to the Node.js server.

Environment Variables:
No new environment variables were added as the project doesn't require any custom configuration. The Docker container uses HOST=127.0.0.1 and PORT=4321 internally.

Changes committed in: bab734c

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/.local/share/pnpm/nodejs/22.16.0/bin/node node /home/REDACTED/work/HapMap/HapMap/node_modules/.bin/../astro/astro.js build (dns block)
    • Triggering command: /home/REDACTED/.local/share/pnpm/nodejs/22.16.0/bin/node node /home/REDACTED/work/HapMap/HapMap/node_modules/.bin/../astro/astro.js check (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add GitHub Actions for Docker container build and push Add Docker support with nginx reverse proxy and GitHub Actions workflow Dec 9, 2025
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