Skip to content

Commit cae5f45

Browse files
Jonathan D.A. Jewellclaude
andcommitted
Add Dockerfile and GHCR publishing workflow
- Multi-stage Dockerfile for wharf-cli and yacht-agent binaries - Automated publishing to ghcr.io on release - Build attestation for supply chain security 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 11ad291 commit cae5f45

2 files changed

Lines changed: 122 additions & 0 deletions

File tree

.github/workflows/ghcr-publish.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
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+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
attestations: write
22+
23+
strategy:
24+
matrix:
25+
target:
26+
- name: wharf-cli
27+
dockerfile-target: wharf-cli
28+
- name: yacht-agent
29+
dockerfile-target: yacht-agent
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
37+
38+
- name: Log in to GHCR
39+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Extract metadata
46+
id: meta
47+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
48+
with:
49+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.target.name }}
50+
tags: |
51+
type=semver,pattern={{version}}
52+
type=semver,pattern={{major}}.{{minor}}
53+
type=ref,event=branch
54+
type=sha
55+
56+
- name: Build and push
57+
id: push
58+
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
59+
with:
60+
context: .
61+
target: ${{ matrix.target.dockerfile-target }}
62+
push: true
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max
67+
68+
- name: Generate artifact attestation
69+
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v2
70+
with:
71+
subject-name: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.target.name }}
72+
subject-digest: ${{ steps.push.outputs.digest }}
73+
push-to-registry: true

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: MIT
2+
# SPDX-FileCopyrightText: 2025 hyperpolymath
3+
4+
# Multi-stage Dockerfile for Project Wharf
5+
# Builds both wharf-cli and yacht-agent binaries
6+
7+
FROM rust:1.83-slim-bookworm AS builder
8+
9+
WORKDIR /build
10+
11+
# Install build dependencies
12+
RUN apt-get update && apt-get install -y \
13+
pkg-config \
14+
libssl-dev \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# Copy workspace files
18+
COPY Cargo.toml Cargo.lock ./
19+
COPY crates/ crates/
20+
COPY bin/ bin/
21+
22+
# Build release binaries
23+
RUN cargo build --release
24+
25+
# Runtime image for wharf-cli
26+
FROM debian:bookworm-slim AS wharf-cli
27+
28+
RUN apt-get update && apt-get install -y \
29+
ca-certificates \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
COPY --from=builder /build/target/release/wharf /usr/local/bin/wharf
33+
34+
ENTRYPOINT ["wharf"]
35+
CMD ["--help"]
36+
37+
# Runtime image for yacht-agent
38+
FROM debian:bookworm-slim AS yacht-agent
39+
40+
RUN apt-get update && apt-get install -y \
41+
ca-certificates \
42+
&& rm -rf /var/lib/apt/lists/*
43+
44+
COPY --from=builder /build/target/release/yacht-agent /usr/local/bin/yacht-agent
45+
46+
EXPOSE 3306 33060 9001
47+
48+
ENTRYPOINT ["yacht-agent"]
49+
CMD ["--help"]

0 commit comments

Comments
 (0)