Skip to content

Commit 0cdf4a2

Browse files
jaredLundeclaude
andauthored
ci: publish beyond-queue image to ghcr (#5)
Multi-stage Dockerfile (build + run on ubuntu:24.04 to match the prod rootfs) and a tag-triggered workflow that builds amd64+arm64 natively, pushes by digest, and assembles a multi-arch manifest at ghcr.io/beyondoss/beyond-queue. Latest action versions; formatted with the repo's dprint config. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8c28691 commit 0cdf4a2

3 files changed

Lines changed: 108 additions & 0 deletions

File tree

‎.dockerignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target
2+
**/node_modules
3+
.git
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release image
2+
on:
3+
push:
4+
tags:
5+
- api-v*
6+
permissions:
7+
contents: read
8+
packages: write
9+
env:
10+
IMAGE: ghcr.io/beyondoss/beyond-queue
11+
jobs:
12+
build:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- runs-on: ubuntu-latest
18+
arch: amd64
19+
- runs-on: ubuntu-24.04-arm
20+
arch: arm64
21+
runs-on: ${{ matrix.runs-on }}
22+
steps:
23+
- uses: actions/checkout@v7
24+
- uses: docker/setup-buildx-action@v4
25+
- uses: docker/login-action@v4
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
- id: build
31+
uses: docker/build-push-action@v7
32+
with:
33+
context: .
34+
platforms: linux/${{ matrix.arch }}
35+
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
36+
cache-from: type=gha,scope=image-${{ matrix.arch }}
37+
cache-to: type=gha,mode=max,scope=image-${{ matrix.arch }}
38+
- name: Export digest
39+
run: |
40+
mkdir -p /tmp/digests
41+
digest="${{ steps.build.outputs.digest }}"
42+
touch "/tmp/digests/${digest#sha256:}"
43+
- uses: actions/upload-artifact@v7
44+
with:
45+
name: digest-${{ matrix.arch }}
46+
path: /tmp/digests/*
47+
if-no-files-found: error
48+
retention-days: 1
49+
merge:
50+
runs-on: ubuntu-latest
51+
needs: [build]
52+
steps:
53+
- uses: actions/download-artifact@v8
54+
with:
55+
path: /tmp/digests
56+
pattern: digest-*
57+
merge-multiple: true
58+
- uses: docker/setup-buildx-action@v4
59+
- uses: docker/login-action@v4
60+
with:
61+
registry: ghcr.io
62+
username: ${{ github.actor }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
- name: Resolve version
65+
id: meta
66+
run: echo "version=${GITHUB_REF_NAME#api-v}" >> "$GITHUB_OUTPUT"
67+
- name: Create manifest list
68+
working-directory: /tmp/digests
69+
run: |
70+
docker buildx imagetools create \
71+
-t ${{ env.IMAGE }}:${{ steps.meta.outputs.version }} \
72+
-t ${{ env.IMAGE }}:latest \
73+
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
74+
- name: Inspect
75+
run: docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}

‎Dockerfile‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# syntax=docker/dockerfile:1
2+
# Slim release image for the beyond-queue server, published to
3+
# ghcr.io/beyondoss/beyond-queue for local-dev / docker-compose use.
4+
# Built and run on ubuntu:24.04 (noble) to match the production rootfs.
5+
FROM ubuntu:24.04 AS builder
6+
ENV DEBIAN_FRONTEND=noninteractive \
7+
RUSTUP_HOME=/usr/local/rustup \
8+
CARGO_HOME=/usr/local/cargo \
9+
PATH=/usr/local/cargo/bin:$PATH
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
build-essential curl ca-certificates clang libclang-dev pkg-config \
12+
libssl-dev protobuf-compiler \
13+
&& rm -rf /var/lib/apt/lists/*
14+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
15+
| sh -s -- -y --default-toolchain 1.92.0 --profile minimal
16+
WORKDIR /src
17+
COPY . .
18+
RUN --mount=type=cache,target=/usr/local/cargo/registry \
19+
--mount=type=cache,target=/src/target,sharing=locked \
20+
cargo build --release --bin beyond-queue \
21+
&& cp /src/target/release/beyond-queue /usr/local/bin/beyond-queue \
22+
&& strip /usr/local/bin/beyond-queue
23+
24+
FROM ubuntu:24.04
25+
RUN apt-get update && apt-get install -y --no-install-recommends \
26+
ca-certificates curl openssl \
27+
&& rm -rf /var/lib/apt/lists/*
28+
COPY --from=builder /usr/local/bin/beyond-queue /usr/local/bin/beyond-queue
29+
EXPOSE 4566
30+
ENTRYPOINT ["/usr/local/bin/beyond-queue", "serve"]

0 commit comments

Comments
 (0)