Skip to content

Commit 810440d

Browse files
TMHSDigitalclaude
andcommitted
ci: publish a multi-arch image to GHCR on release
Docker was documented as an install path but no image was published. Add a publish-image job that runs after the release goes public and pushes linux/amd64 and linux/arm64 to ghcr.io/tmhsdigital/subenum with build provenance. Tags are X.Y.Z, X.Y, and latest (skipped for prerelease tags). The Dockerfile builder now runs on the build platform and cross-compiles via TARGETOS/TARGETARCH, so no QEMU is needed. Fixes #40 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 17d8954 commit 810440d

5 files changed

Lines changed: 114 additions & 5 deletions

File tree

‎.github/workflows/go.yml‎

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,27 @@ jobs:
8484
if: matrix.go == 'stable'
8585
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
8686

87+
# Builds the Dockerfile for both published platforms without pushing, so a
88+
# broken image is caught on the PR rather than during a release.
89+
docker:
90+
runs-on: ubuntu-latest
91+
permissions:
92+
contents: read
93+
94+
steps:
95+
- uses: actions/checkout@v7
96+
97+
- name: Set up Docker Buildx
98+
uses: docker/setup-buildx-action@v3
99+
100+
- name: Build image (no push)
101+
uses: docker/build-push-action@v6
102+
with:
103+
context: .
104+
platforms: linux/amd64,linux/arm64
105+
push: false
106+
build-args: VERSION=ci
107+
87108
# Single job that owns release creation. It runs once (not a matrix), so
88109
# exactly one job ever creates the release for the tag. The upload-assets
89110
# matrix below then only adds files to this already-existing release and can
@@ -95,7 +116,7 @@ jobs:
95116
# published only after all assets are present, so the public never sees a
96117
# partial or empty release.
97118
create-release:
98-
needs: build
119+
needs: [ build, docker ]
99120
if: startsWith(github.ref, 'refs/tags/v')
100121
runs-on: ubuntu-latest
101122
permissions:
@@ -220,6 +241,68 @@ jobs:
220241
env:
221242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222243

244+
# Publishes a multi-arch image to GHCR once the release itself is public
245+
# (#40). The Dockerfile cross-compiles in a build-platform builder stage, so
246+
# arm64 needs no QEMU. `latest` only moves for non-prerelease tags.
247+
publish-image:
248+
needs: publish-release
249+
if: startsWith(github.ref, 'refs/tags/v')
250+
runs-on: ubuntu-latest
251+
permissions:
252+
contents: read
253+
packages: write
254+
id-token: write
255+
attestations: write
256+
257+
steps:
258+
- uses: actions/checkout@v7
259+
260+
# GHCR requires lowercase repository names; the owner is mixed case.
261+
- name: Compute image name
262+
id: image
263+
shell: bash
264+
env:
265+
OWNER: ${{ github.repository_owner }}
266+
run: echo "name=ghcr.io/${OWNER,,}/subenum" >> "$GITHUB_OUTPUT"
267+
268+
- name: Set up Docker Buildx
269+
uses: docker/setup-buildx-action@v3
270+
271+
- name: Log in to GHCR
272+
uses: docker/login-action@v3
273+
with:
274+
registry: ghcr.io
275+
username: ${{ github.actor }}
276+
password: ${{ secrets.GITHUB_TOKEN }}
277+
278+
- name: Image metadata
279+
id: meta
280+
uses: docker/metadata-action@v5
281+
with:
282+
images: ${{ steps.image.outputs.name }}
283+
tags: |
284+
type=semver,pattern={{version}}
285+
type=semver,pattern={{major}}.{{minor}}
286+
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
287+
288+
- name: Build and push
289+
id: push
290+
uses: docker/build-push-action@v6
291+
with:
292+
context: .
293+
platforms: linux/amd64,linux/arm64
294+
push: true
295+
tags: ${{ steps.meta.outputs.tags }}
296+
labels: ${{ steps.meta.outputs.labels }}
297+
build-args: VERSION=${{ github.ref_name }}
298+
299+
- name: Attest image provenance
300+
uses: actions/attest-build-provenance@v3
301+
with:
302+
subject-name: ${{ steps.image.outputs.name }}
303+
subject-digest: ${{ steps.push.outputs.digest }}
304+
push-to-registry: true
305+
223306
# Failure-path cleanup. If the upload matrix fails partway, publish-release is
224307
# skipped and the draft release created above would otherwise linger
225308
# invisibly until someone removes it by hand. This job runs only when a

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
- `-show-records` appends `TYPE=value` record pairs to `text` output on stdout and in the `-o` file (#34, ROADMAP N2).
2727
- TUI form gains *Max Names* (`-max-queries`) and *No Abort* (`-no-abort`), both persisted in `last.json`. A recursive TUI scan above the 1e7 ceiling can now be started with a cap instead of enabling *Force*, which also disables the wildcard abort (#35).
2828
- `-seed <n>` makes simulation mode reproducible: each outcome, record and reported timing is derived from the seed and the name, so the same seed gives the same results. Without `-seed` a random seed is chosen and printed in the simulation banner (#44).
29+
- Tagged releases publish a multi-arch (`linux/amd64`, `linux/arm64`) image to `ghcr.io/tmhsdigital/subenum` with build provenance, tagged `X.Y.Z`, `X.Y`, and `latest` (non-prereleases only). The Dockerfile now cross-compiles in a build-platform builder stage, so no QEMU emulation is needed (#40).
2930

3031
### Changed
3132
- When stdout is not a terminal, `text` results are printed as bare subdomain names (no `Found:` prefix), so `subenum ... | sort -u` or `| httpx` works without `cut`. Terminal output is unchanged. `examples/multi_domain_scan.sh` now counts lines instead of `Found:` (#34).

‎Dockerfile‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Builder uses a current, supported Go toolchain (go.mod 1.24.2 is only the
2-
# minimum); Dependabot keeps both digests fresh.
3-
FROM golang:1.27.1-alpine@sha256:8a5910f31396cd4d89662f56c68b3ae31d374308270a1c3bd96672ee5ed43414 AS builder
2+
# minimum); Dependabot keeps both digests fresh. It runs on the build host's
3+
# platform and cross-compiles for the target, so multi-arch images (#40) need
4+
# no QEMU emulation.
5+
FROM --platform=$BUILDPLATFORM golang:1.27.1-alpine@sha256:8a5910f31396cd4d89662f56c68b3ae31d374308270a1c3bd96672ee5ed43414 AS builder
6+
7+
# Set by BuildKit for each platform being built.
8+
ARG TARGETOS
9+
ARG TARGETARCH
410

511
WORKDIR /app
612

@@ -16,7 +22,7 @@ COPY main.go ./
1622
COPY internal/ ./internal/
1723

1824
# Build the binary with optimizations
19-
RUN CGO_ENABLED=0 GOOS=linux go build -o subenum -ldflags="-w -s -X main.Version=${VERSION}" .
25+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -o subenum -ldflags="-w -s -X main.Version=${VERSION}" .
2026

2127
FROM gcr.io/distroless/static:nonroot@sha256:e2e927ec666bae08560abb3c55d0659eceabb657f56b6782ab500a9fc7f555e3
2228

@@ -34,7 +40,7 @@ ENTRYPOINT ["/usr/local/bin/subenum"]
3440
CMD ["-version"]
3541

3642
LABEL org.opencontainers.image.title="subenum"
37-
LABEL org.opencontainers.image.description="A Go-based CLI tool for subdomain enumeration"
43+
LABEL org.opencontainers.image.description="Fast concurrent subdomain enumeration via DNS brute-forcing"
3844
LABEL org.opencontainers.image.source="https://github.com/TMHSDigital/subenum"
3945
LABEL org.opencontainers.image.licenses="GPL-3.0"
4046
LABEL org.opencontainers.image.documentation="https://github.com/TMHSDigital/subenum/blob/main/README.md"

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ SHA-256 checksums are provided alongside each binary.
185185
<details>
186186
<summary><strong>Docker</strong></summary>
187187

188+
Releases after v0.7.0 publish a multi-arch image (`linux/amd64`, `linux/arm64`) to GHCR:
189+
190+
```bash
191+
docker run --rm -v "$(pwd)/data:/data" ghcr.io/tmhsdigital/subenum:latest -w /data/wordlist.txt example.com
192+
```
193+
194+
Or build it locally:
195+
188196
```bash
189197
docker build -t subenum .
190198
docker run --rm -v $(pwd)/data:/data subenum -w /data/wordlist.txt example.com

‎docs/docker.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ This guide explains how to use `subenum` with Docker for a containerized subdoma
1212
- Docker installed on your system
1313
- Docker Compose (optional, for easy management)
1414

15+
## Pulling the published image
16+
17+
Releases after v0.7.0 publish a multi-arch (`linux/amd64`, `linux/arm64`) image to the GitHub Container Registry, with build provenance attached. Tags follow the release: `X.Y.Z`, `X.Y`, and `latest` for the newest non-prerelease.
18+
19+
```bash
20+
docker run --rm ghcr.io/tmhsdigital/subenum:latest -version
21+
docker run --rm -v "$(pwd)/data:/data" ghcr.io/tmhsdigital/subenum:latest -w /data/wordlist.txt example.com
22+
```
23+
24+
Verify provenance with `gh attestation verify oci://ghcr.io/tmhsdigital/subenum:latest --owner TMHSDigital`.
25+
1526
## Building the Docker Image
1627

1728
### Using docker build

0 commit comments

Comments
 (0)