Skip to content

Commit 5b06a0d

Browse files
Jonathan D.A. Jewellclaude
andcommitted
Add Containerfile and GHCR publishing workflow
- Multi-stage build with SSL support - nerdctl/buildkit workflow for GHCR 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0501166 commit 5b06a0d

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

.github/workflows/ghcr-publish.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-License-Identifier: MIT OR Apache-2.0
2+
name: Publish to GHCR
3+
4+
permissions: read-all
5+
6+
on:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
25+
26+
- name: Install nerdctl and containerd
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y containerd
30+
sudo systemctl start containerd
31+
32+
NERDCTL_VERSION=2.2.1
33+
curl -fsSL "https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-full-${NERDCTL_VERSION}-linux-amd64.tar.gz" -o /tmp/nerdctl.tar.gz
34+
sudo tar -xzf /tmp/nerdctl.tar.gz -C /usr/local
35+
sudo mkdir -p /opt/cni/bin
36+
sudo cp /usr/local/libexec/cni/* /opt/cni/bin/ 2>/dev/null || true
37+
38+
sudo /usr/local/bin/buildkitd &
39+
sleep 3
40+
41+
- name: Log in to GHCR
42+
run: |
43+
echo "${{ secrets.GITHUB_TOKEN }}" | sudo nerdctl login ghcr.io -u ${{ github.actor }} --password-stdin
44+
45+
- name: Build image
46+
run: |
47+
sudo nerdctl build -f Containerfile -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} .
48+
sudo nerdctl tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
49+
50+
- name: Push image
51+
run: |
52+
sudo nerdctl push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
53+
sudo nerdctl push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
54+
55+
- name: Tag release version
56+
if: github.event_name == 'release'
57+
run: |
58+
VERSION=${{ github.event.release.tag_name }}
59+
sudo nerdctl tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
60+
sudo nerdctl push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}

Containerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: MIT OR Apache-2.0
2+
# SPDX-FileCopyrightText: 2025 hyperpolymath
3+
4+
FROM rust:1.85-slim-bookworm AS builder
5+
6+
WORKDIR /build
7+
8+
RUN apt-get update && apt-get install -y \
9+
pkg-config \
10+
libssl-dev \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
COPY Cargo.toml Cargo.lock* ./
14+
COPY src/ src/
15+
16+
RUN cargo build --release --bin conflow
17+
18+
FROM debian:bookworm-slim
19+
20+
RUN apt-get update && apt-get install -y \
21+
ca-certificates \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
COPY --from=builder /build/target/release/conflow /usr/local/bin/conflow
25+
26+
ENTRYPOINT ["conflow"]
27+
CMD ["--help"]

0 commit comments

Comments
 (0)