chore(pushd/ci): Build image pushd image in-fork.
Some checks failed
Docker / base (release) Failing after 32s
Docker / Build pushd image (release) Has been skipped
Rust build, test, and generate specification / Rust project (push) Has been cancelled

This commit is contained in:
jmug
2026-06-27 00:28:39 -07:00
parent 7d099d5ae7
commit 1504874b27
2 changed files with 102 additions and 132 deletions

View File

@@ -1,141 +1,108 @@
name: Docker Test & Publish name: Docker
on: on:
push: push:
# branches: branches:
# - "main" - "handmade"
tags:
- "*"
paths-ignore:
- ".github/**"
- "!.github/workflows/docker.yml"
- ".vscode/**"
- "doc/**"
- ".gitignore"
- "LICENSE"
- "README"
pull_request: pull_request:
branches: branches:
- "main" - "handmade"
paths: release:
- "Dockerfile" types:
workflow_dispatch: - published
permissions: permissions:
contents: read contents: read
packages: write
jobs: jobs:
base: # Builds the shared base image: the whole Rust workspace compiled once.
runs-on: ubuntu-latest # Every service image (currently only pushd) is derived from this so the
name: Build base image # workspace is built a single time per release. On non-release events this
steps: # still runs as a compile check, but nothing is pushed.
# Configure build environment base:
- name: Checkout runs-on: ubuntu-latest
uses: actions/checkout@v3 steps:
- name: Set up Docker Buildx - name: Checkout
uses: docker/setup-buildx-action@v2 uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Resolve registry host
id: registry
run: echo "host=${GITHUB_SERVER_URL#*://}" >> "$GITHUB_OUTPUT"
- name: Base image ref
id: base
run: echo "image=${{ steps.registry.outputs.host }}/${{ github.repository_owner }}/handmade-revolt-base" >> "$GITHUB_OUTPUT"
- name: Login to registry
uses: docker/login-action@v3
if: github.event_name == 'release'
with:
registry: ${{ steps.registry.outputs.host }}
username: ${{ secrets.PACKAGE_PUBLISH_USERNAME }}
password: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
- name: Build base image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: ${{ github.event_name == 'release' }}
platforms: linux/amd64
# Pinned to the commit so the publish job below consumes this
# exact base.
tags: |
${{ steps.base.outputs.image }}:latest
${{ steps.base.outputs.image }}:${{ github.sha }}
# Authenticate with GHCR # Builds individual service images from the base. Only runs on release.
- name: Login to Github Container Registry publish:
if: ${{ github.event_name != 'pull_request' }} needs: [base]
uses: docker/login-action@v2 runs-on: ubuntu-latest
with: if: github.event_name == 'release'
registry: ghcr.io strategy:
username: ${{ github.actor }} matrix:
password: ${{ secrets.GITHUB_TOKEN }} # Only pushd is built. To add more services later, add
# entries here (paths/images mirror the upstream revolt layout):
- name: Build base image # - { project: delta, path: crates/delta, image: handmade-revolt-server }
uses: docker/build-push-action@v4 # - { project: bonfire, path: crates/bonfire, image: handmade-revolt-bonfire }
with: # - { project: autumn, path: crates/services/autumn, image: handmade-revolt-autumn }
context: . # - { project: january, path: crates/services/january, image: handmade-revolt-january }
push: ${{ github.event_name != 'pull_request' }} # - { project: crond, path: crates/daemons/crond, image: handmade-revolt-crond }
platforms: linux/amd64,linux/arm64 include:
tags: ghcr.io/${{ github.repository_owner }}/base:latest - { project: pushd, path: crates/daemons/pushd, image: handmade-revolt-pushd }
cache-from: type=gha,scope=buildx-base-multi-arch name: Build ${{ matrix.project }} image
cache-to: type=gha,scope=buildx-base-multi-arch,mode=max steps:
- name: Checkout
publish: uses: actions/checkout@v4
needs: [base] - name: Set up Docker Buildx
runs-on: ubuntu-latest uses: docker/setup-buildx-action@v3
if: github.event_name != 'pull_request' - name: Resolve registry host
strategy: id: registry
matrix: run: echo "host=${GITHUB_SERVER_URL#*://}" >> "$GITHUB_OUTPUT"
project: [delta, bonfire, autumn, january, pushd] - name: Docker meta
name: Build ${{ matrix.project }} image id: meta
steps: uses: docker/metadata-action@v5
# Configure build environment with:
- name: Checkout images: ${{ steps.registry.outputs.host }}/${{ github.repository_owner }}/${{ matrix.image }}
uses: actions/checkout@v3 tags: |
- name: Set up Docker Buildx type=semver,pattern={{version}}
uses: docker/setup-buildx-action@v2 type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
# Authenticate with Docker Hub and GHCR env:
- name: Login to DockerHub DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
uses: docker/login-action@v2 - name: Login to registry
with: uses: docker/login-action@v3
registry: docker.io with:
username: ${{ secrets.DOCKERHUB_USERNAME }} registry: ${{ steps.registry.outputs.host }}
password: ${{ secrets.DOCKERHUB_TOKEN }} username: ${{ secrets.PACKAGE_PUBLISH_USERNAME }}
- name: Login to Github Container Registry password: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
uses: docker/login-action@v2 - name: Build and publish
with: uses: docker/build-push-action@v6
registry: ghcr.io with:
username: ${{ github.actor }} context: .
password: ${{ secrets.GITHUB_TOKEN }} file: ${{ matrix.path }}/Dockerfile
push: true
# Resolve the correct project platforms: linux/amd64
- uses: kanga333/variable-mapper@master build-args: |
id: export BASE_IMAGE=${{ steps.registry.outputs.host }}/${{ github.repository_owner }}/handmade-revolt-base:${{ github.sha }}
with: tags: ${{ steps.meta.outputs.tags }}
key: "${{ matrix.project }}" annotations: ${{ steps.meta.outputs.annotations }}
map: | labels: ${{ steps.meta.outputs.labels }}
{
"delta": {
"path": "crates/delta",
"tag": "${{ github.repository_owner }}/server"
},
"bonfire": {
"path": "crates/bonfire",
"tag": "${{ github.repository_owner }}/bonfire"
},
"autumn": {
"path": "crates/services/autumn",
"tag": "${{ github.repository_owner }}/autumn"
},
"january": {
"path": "crates/services/january",
"tag": "${{ github.repository_owner }}/january"
},
"pushd": {
"path": "crates/daemons/pushd",
"tag": "${{ github.repository_owner }}/pushd"
},
"crond": {
"path": "crates/daemons/crond",
"tag": "${{ github.repository_owner }}/crond"
}
}
export_to: output
# Configure metadata
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
docker.io/${{ steps.export.outputs.tag }}
ghcr.io/${{ steps.export.outputs.tag }}
# Build crate image
- name: Publish
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
file: ${{ steps.export.outputs.path }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/base:latest
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,5 +1,8 @@
# Build Stage # Build Stage
FROM ghcr.io/revoltchat/base:latest AS builder # BASE_IMAGE is the compiled workspace base image. Defaults to the upstream
# revolt base, but CI overrides it with our own base built from repo.
ARG BASE_IMAGE=ghcr.io/revoltchat/base:latest
FROM ${BASE_IMAGE} AS builder
FROM debian:12 AS debian FROM debian:12 AS debian
# Bundle Stage # Bundle Stage