Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a6a732e
First commit to build docker images via GitHub actions
basictheprogram May 11, 2025
9eb4c8e
Allow actions from GitHub UI
basictheprogram May 11, 2025
45c78dc
chore: convert docker-login-action to composite and fix secret wiring
basictheprogram May 11, 2025
f2f3a02
chore: debug using docker/login-action@v3
basictheprogram May 11, 2025
1d1bf87
Use my docker hub account name
basictheprogram May 11, 2025
03e3b5e
Ensures that all matrix jobs run to completion, even if one fails.
basictheprogram May 11, 2025
3589323
Fixed typo in file name
basictheprogram May 11, 2025
1b7447f
Fixed indentation and whitespaces
basictheprogram May 11, 2025
777cbb3
Replace '/' with '-' to make it tag-safe
basictheprogram May 11, 2025
701c98d
Refactor the manifest to use the compose workflow
basictheprogram May 11, 2025
8690010
Checkout the project before working on it?
basictheprogram May 11, 2025
31a239d
Fix for invalid referance format
basictheprogram May 11, 2025
70b15ff
Attempt to build and push and /not/ user manifests
basictheprogram May 11, 2025
4f23f02
Pass in image_name to the build action
basictheprogram May 11, 2025
89ecafe
Fixed variable reference
basictheprogram May 11, 2025
84859d9
feat(ci): tag Docker images based on Git tag version
basictheprogram May 11, 2025
cc3520f
refactor(workflow): inline version extraction with default fallback
basictheprogram May 11, 2025
0367237
The workflow must contain at least one job with no dependencies.
basictheprogram May 11, 2025
9d0ec15
Use ${{ steps.versioning.outputs.* }} to access the values.
basictheprogram May 11, 2025
6b6deac
Use version not versioning
basictheprogram May 11, 2025
d352ced
Added full version and major version tags to the image
basictheprogram May 14, 2025
4179b4d
Add in version_full, version_major variables
basictheprogram May 14, 2025
fa7a74b
Only tag versioned images when things are "git tagged" is used
basictheprogram May 14, 2025
d8c92b1
Refactor version tags to be MAJOR.MINOR
basictheprogram May 14, 2025
84b752d
Removed stray quotes
basictheprogram May 14, 2025
e626a81
Fixed the problem caused by Bash not expanding ${{ inputs.* }} inside…
basictheprogram May 14, 2025
78eb8d2
This should NOT run release tags
basictheprogram May 15, 2025
0056c5a
minor=${MAJOR}.${MINOR}
basictheprogram May 16, 2025
a229c6e
feat: refactor Docker build workflow with dynamic versioning and matr…
basictheprogram May 16, 2025
4273227
Added build_date variable definition
basictheprogram May 16, 2025
13af50c
refactor: remove per-platform build matrix and hardcoded platform input
basictheprogram May 16, 2025
71fe59d
Fixed open if statement
basictheprogram May 16, 2025
5212747
Added apline version to the docker image tag
basictheprogram May 16, 2025
164c749
Fixing my struggle with how GitHub workflows pass around variables
basictheprogram May 16, 2025
ae940f0
Hard code the apline and version in the image tag
basictheprogram May 16, 2025
4159526
Activate the tagged version GitHub workflow
basictheprogram May 17, 2025
6449c42
feat(docker): parameterize Alpine version for multi-version build matrix
basictheprogram May 17, 2025
9b25a17
Fixed YAML interprets unquoted values like 3.20 as floating-point num…
basictheprogram May 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/actions/build-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build Docker Images

description: |
This action builds Docker images for multiple platforms using docker buildx.

inputs:
image_name:
description: 'Name of the Docker image (e.g., mailman-core, mailman-web, postorius)'
required: true
commit_id:
description: 'Git commit hash to tag the image'
required: true
tag_ns:
description: 'DockerHub namespace (e.g., your-dockerhub-username)'
required: true
dockerfile_path:
description: 'Path to the Dockerfile'
required: true
build_dir:
description: 'Directory of the build context'
required: true
alpine_version:
description: 'Alpine version to use in the Dockerfile'
required: true

runs:
using: "composite"
steps:
- name: Determine commit and version info
id: meta
shell: bash
run: |
set -e
echo "commit_id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
VERSION="0.5.2"

if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
RAW_TAG="${GITHUB_REF##*/}"
VERSION="${RAW_TAG#v}"
fi

IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"

echo "version_full=$VERSION" >> $GITHUB_OUTPUT
echo "version_major=$MAJOR" >> $GITHUB_OUTPUT
echo "version_minor=${MAJOR}.${MINOR}" >> $GITHUB_OUTPUT
echo "version_patch=$PATCH" >> $GITHUB_OUTPUT

- name: Build Rolling Release for ${{ inputs.platform }}
shell: bash
run: |
set -e
build_date=$(date +%Y%m%d)

docker buildx build \
--platform linux/amd64,linux/arm64 \
--label version.git_commit="${{ steps.meta.outputs.commit_id }}" \
--build-arg ALPINE_VERSION="${{ inputs.alpine_version }}" \
-t "${{ inputs.tag_ns }}/${{ inputs.image_name }}:rolling-${build_date}-alpine${{ inputs.alpine_version }}" \
-f "${{ inputs.dockerfile_path }}" "${{ inputs.build_dir }}" \
--push

- name: Tag and Push Versioned Images
shell: bash
run: |
set -e
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then

for version_tag in "${{ steps.meta.outputs.version_full }}" "${{ steps.meta.outputs.version_minor }}"; do
echo "Tagging and pushing: $version_tag"
docker buildx build \
--platform linux/amd64,linux/arm64 \
--label version.git_commit="${{ steps.meta.outputs.commit_id }}" \
--build-arg ALPINE_VERSION="${{ inputs.alpine_version }}" \
-t "${{ inputs.tag_ns }}/${{ inputs.image_name }}:${version_tag}-alpine${{ inputs.alpine_version }}" \
-f "${{ inputs.dockerfile_path }}" "${{ inputs.build_dir }}" \
--push
done
else
echo "No git tag detected; skipping versioned image tagging."
fi
39 changes: 39 additions & 0 deletions .github/actions/manifest-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Push Multi-Arch Docker Manifests

description: |
This action creates and pushes multi-architecture Docker image manifests.

inputs:
tag_ns:
description: 'DockerHub namespace (e.g., your-dockerhub-username)'
required: true
commit_id:
description: 'Git commit hash to tag the image'
required: true

runs:
using: "composite"
steps:
- name: Push multi-arch manifests for mailman-core
shell: bash
run: |
docker manifest create ${{ inputs.tag_ns }}/mailman-core:rolling \
--amend ${{ inputs.tag_ns }}/mailman-core:rolling-linux-amd64 \
--amend ${{ inputs.tag_ns }}/mailman-core:rolling-linux-arm64
docker manifest push ${{ inputs.tag_ns }}/mailman-core:rolling

- name: Push multi-arch manifests for mailman-web
shell: bash
run: |
docker manifest create ${{ inputs.tag_ns }}/mailman-web:rolling \
--amend ${{ inputs.tag_ns }}/mailman-web:rolling-linux-amd64 \
--amend ${{ inputs.tag_ns }}/mailman-web:rolling-linux-arm64
docker manifest push ${{ inputs.tag_ns }}/mailman-web:rolling

- name: Push multi-arch manifests for postorius
shell: bash
run: |
docker manifest create ${{ inputs.tag_ns }}/postorius:rolling \
--amend ${{ inputs.tag_ns }}/postorius:rolling-linux-amd64 \
--amend ${{ inputs.tag_ns }}/postorius:rolling-linux-arm64
docker manifest push ${{ inputs.tag_ns }}/postorius:rolling
73 changes: 73 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Docker Multi-Arch Build

on:
# Manual trigger from GitHub UI
workflow_dispatch:
inputs:
build_rolling:
description: 'Build rolling images?'
required: false
default: 'no'

# Auto-trigger on push to these branches
push:
branches:
- main
- issue-731
tags:
- 'v*'

env:
DOCKER_BUILDKIT: 1
TAG_NS: basictheprogram
PUSH: yes

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
alpine_version: ["3", "3.20", "3.21", "3.21.3"]
image:
- name: mailman-core
dockerfile: core/Dockerfile.dev
context: core/
- name: mailman-web
dockerfile: web/Dockerfile.dev
context: web/
- name: postorius
dockerfile: postorius/Dockerfile.dev
context: postorius/
fail-fast: false

continue-on-error: true

steps:
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v4

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU for multi-platform builds
uses: docker/setup-qemu-action@v3

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build ${{ matrix.image.name }} (Multi-Arch)
uses: ./.github/actions/build-action
with:
image_name: ${{ matrix.image.name }}
commit_id: ${{ env.COMMIT_ID }}
tag_ns: ${{ env.TAG_NS }}
dockerfile_path: ${{ matrix.image.dockerfile }}
build_dir: ${{ matrix.image.context }}
alpine_version: ${{ matrix.alpine_version }}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: CI

# Controls when the action will run.
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/web/mailman-web/settings_local.py
pythonenv3.8/*
.venv/*
zzz.diff
5 changes: 4 additions & 1 deletion core/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# syntax = docker/dockerfile:1.3
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}

# Use 3.15 for Core since it has Python 3.9
FROM alpine:3.21
# FROM alpine:3.21

# Set the commits that we are building.
ARG CORE_REF
Expand Down
5 changes: 4 additions & 1 deletion postorius/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# syntax = docker/dockerfile:1.3
FROM alpine:3.21.3
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}

# FROM alpine:3.21.3

ARG POSTORIUS_REF
ARG DJ_MM3_REF
Expand Down
5 changes: 4 additions & 1 deletion web/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# syntax = docker/dockerfile:1.3
FROM alpine:3.21.3
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}

# FROM alpine:3.21.3

ARG POSTORIUS_REF
ARG HYPERKITTY_REF
Expand Down