Skip to content

Commit c973505

Browse files
Jonathan D.A. Jewellclaude
andcommitted
Add Dockerfile and GHCR publishing workflow
- Multi-stage Docker build for echidna binary - GHCR workflow with artifact attestation - SHA-pinned actions for security compliance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8a8d721 commit c973505

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

.github/workflows/ghcr-publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SPDX-License-Identifier: MIT OR Palimpsest-0.6
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+
id-token: write
22+
attestations: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
30+
31+
- name: Log in to GHCR
32+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract metadata
39+
id: meta
40+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43+
tags: |
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=ref,event=branch
47+
type=sha
48+
49+
- name: Build and push
50+
id: push
51+
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
52+
with:
53+
context: .
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
60+
- name: Generate artifact attestation
61+
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v2
62+
with:
63+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64+
subject-digest: ${{ steps.push.outputs.digest }}
65+
push-to-registry: true

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: MIT OR Palimpsest-0.6
2+
# SPDX-FileCopyrightText: 2025 ECHIDNA Project Contributors
3+
4+
FROM rust:1.83-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
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/echidna /usr/local/bin/echidna
25+
26+
ENTRYPOINT ["echidna"]
27+
CMD ["--help"]

0 commit comments

Comments
 (0)