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.
This commit is contained in:
@@ -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
|
||||||
@@ -6,6 +6,14 @@ COPY . .
|
|||||||
RUN npx next build --webpack
|
RUN npx next build --webpack
|
||||||
|
|
||||||
FROM node:24-alpine AS runner
|
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
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
RUN addgroup --system --gid 1001 nodejs && \
|
RUN addgroup --system --gid 1001 nodejs && \
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ This webmail client is designed to work seamlessly with [**Stalwart Mail Server*
|
|||||||
- Persistent language preference
|
- Persistent language preference
|
||||||
|
|
||||||
### Deployment
|
### 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
|
- Docker support with multi-stage build and standalone output
|
||||||
- Runtime environment variables (no rebuild needed for config changes)
|
- Runtime environment variables (no rebuild needed for config changes)
|
||||||
- Health check endpoint for container orchestration
|
- Health check endpoint for container orchestration
|
||||||
@@ -198,12 +199,15 @@ npm start
|
|||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
```bash
|
```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
|
# Using docker-compose
|
||||||
cp .env.example .env.local
|
cp .env.example .env.local
|
||||||
# Edit .env.local with your JMAP_SERVER_URL
|
# Edit .env.local with your JMAP_SERVER_URL
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|
||||||
# Or build manually
|
# Or build from source
|
||||||
docker build -t jmap-webmail .
|
docker build -t jmap-webmail .
|
||||||
docker run -p 3000:3000 -e JMAP_SERVER_URL=https://mail.example.com jmap-webmail
|
docker run -p 3000:3000 -e JMAP_SERVER_URL=https://mail.example.com jmap-webmail
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -217,6 +217,8 @@ This document tracks the development status and planned features for JMAP Webmai
|
|||||||
- [x] Health check endpoint
|
- [x] Health check endpoint
|
||||||
- [x] Docker support (multi-stage build, docker-compose, standalone output)
|
- [x] Docker support (multi-stage build, docker-compose, standalone output)
|
||||||
- [x] Structured server-side logger (text/JSON format, configurable level)
|
- [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
|
## Planned Features
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user