From a932e1a1c75b05282b60bfba6067e3cecd97f115 Mon Sep 17 00:00:00 2001 From: Matthieu MALVACHE Date: Sat, 21 Feb 2026 23:30:44 +0100 Subject: [PATCH] feat: add GHCR Docker image publishing with multi-arch support Add GitHub Actions workflow to automatically build and publish Docker images to ghcr.io on releases. Supports amd64 and arm64 architectures. Pre-built image available at ghcr.io/root-fr/jmap-webmail. --- .github/workflows/docker-publish.yml | 56 ++++++++++++++++++++++++++++ Dockerfile | 8 ++++ README.md | 6 ++- ROADMAP.md | 2 + 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 00000000..e00663ee --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,56 @@ +name: Publish Docker Image + +on: + push: + branches: [main] + tags: ["v*.*.*"] + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index b34a9f4c..438342c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,14 @@ COPY . . RUN npx next build --webpack FROM node:24-alpine AS runner + +LABEL org.opencontainers.image.title="JMAP Webmail" +LABEL org.opencontainers.image.description="Modern webmail client built with Next.js and the JMAP protocol" +LABEL org.opencontainers.image.source="https://github.com/root-fr/jmap-webmail" +LABEL org.opencontainers.image.url="https://github.com/root-fr/jmap-webmail" +LABEL org.opencontainers.image.licenses="MIT" +LABEL org.opencontainers.image.vendor="root.cloud" + WORKDIR /app ENV NODE_ENV=production RUN addgroup --system --gid 1001 nodejs && \ diff --git a/README.md b/README.md index 707efc86..3f7756ae 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ This webmail client is designed to work seamlessly with [**Stalwart Mail Server* - Persistent language preference ### Deployment +- Pre-built Docker image on [GitHub Container Registry](https://ghcr.io/root-fr/jmap-webmail) (amd64/arm64) - Docker support with multi-stage build and standalone output - Runtime environment variables (no rebuild needed for config changes) - Health check endpoint for container orchestration @@ -198,12 +199,15 @@ npm start ### Docker ```bash +# Using the pre-built image (recommended) +docker run -p 3000:3000 -e JMAP_SERVER_URL=https://mail.example.com ghcr.io/root-fr/jmap-webmail:latest + # Using docker-compose cp .env.example .env.local # Edit .env.local with your JMAP_SERVER_URL docker compose up -d -# Or build manually +# Or build from source docker build -t jmap-webmail . docker run -p 3000:3000 -e JMAP_SERVER_URL=https://mail.example.com jmap-webmail ``` diff --git a/ROADMAP.md b/ROADMAP.md index 7b9fa156..bd4dd0f6 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -217,6 +217,8 @@ This document tracks the development status and planned features for JMAP Webmai - [x] Health check endpoint - [x] Docker support (multi-stage build, docker-compose, standalone output) - [x] Structured server-side logger (text/JSON format, configurable level) +- [x] Pre-built Docker image on GitHub Container Registry (ghcr.io) with multi-arch support (amd64/arm64) +- [x] GitHub Actions CI/CD for automated image publishing on releases ## Planned Features