Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# build stage
FROM golang:alpine AS build
RUN apk update && apk add git
ADD . /src
WORKDIR /src
ENV CGO_ENABLED=0
RUN go build \
-ldflags "-X github.com/jpillora/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
-o /tmp/bin
# run stage
FROM alpine:3 AS certs
RUN apk add --no-cache ca-certificates

FROM scratch
LABEL maintainer="dev@jpillora.com"
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY --from=build /tmp/bin /app/bin
ENTRYPOINT ["/app/bin"]
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY chisel /app/bin
ENTRYPOINT ["/app/bin"]
136 changes: 136 additions & 0 deletions .github/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,139 @@ changelog:
exclude:
- "^docs:"
- "^test:"

dockers:
- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-amd64"
- "docker.io/jpillora/chisel:{{ .Version }}-amd64"
use: buildx
dockerfile: .github/Dockerfile
Comment on lines +64 to +68
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker image tags/manifests are templated with {{ .Tag }}, which will include the leading v from git tags (e.g., v1.2.3). This differs from the prior workflow’s semver tags (e.g., 1.2.3) and from the binary BuildVersion which uses {{ .Version }}. If you want to preserve existing Docker tag semantics, switch these templates to use {{ .Version }} (and update all related templates consistently).

Copilot uses AI. Check for mistakes.
build_flag_templates:
- "--platform=linux/amd64"
goarch: amd64

- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-arm64"
- "docker.io/jpillora/chisel:{{ .Version }}-arm64"
use: buildx
dockerfile: .github/Dockerfile
build_flag_templates:
- "--platform=linux/arm64"
goarch: arm64

- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv7"
- "docker.io/jpillora/chisel:{{ .Version }}-armv7"
use: buildx
dockerfile: .github/Dockerfile
build_flag_templates:
- "--platform=linux/arm/v7"
goarch: arm
goarm: "7"

- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv6"
- "docker.io/jpillora/chisel:{{ .Version }}-armv6"
use: buildx
dockerfile: .github/Dockerfile
build_flag_templates:
- "--platform=linux/arm/v6"
goarch: arm
goarm: "6"

- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-386"
- "docker.io/jpillora/chisel:{{ .Version }}-386"
use: buildx
dockerfile: .github/Dockerfile
build_flag_templates:
- "--platform=linux/386"
goarch: "386"

- image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-ppc64le"
- "docker.io/jpillora/chisel:{{ .Version }}-ppc64le"
use: buildx
dockerfile: .github/Dockerfile
build_flag_templates:
- "--platform=linux/ppc64le"
goarch: ppc64le

docker_manifests:
- name_template: "ghcr.io/jpillora/chisel:{{ .Version }}"
image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-amd64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-arm64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv7"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv6"
- "ghcr.io/jpillora/chisel:{{ .Version }}-386"
- "ghcr.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "ghcr.io/jpillora/chisel:{{ .Major }}"
skip_push: "{{ if .Prerelease }}true{{ else }}false{{ end }}"
image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-amd64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-arm64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv7"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv6"
- "ghcr.io/jpillora/chisel:{{ .Version }}-386"
- "ghcr.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "ghcr.io/jpillora/chisel:{{ .Major }}.{{ .Minor }}"
skip_push: "{{ if .Prerelease }}true{{ else }}false{{ end }}"
image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-amd64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-arm64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv7"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv6"
- "ghcr.io/jpillora/chisel:{{ .Version }}-386"
- "ghcr.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "ghcr.io/jpillora/chisel:latest"
skip_push: "{{ if .Prerelease }}true{{ else }}false{{ end }}"
image_templates:
- "ghcr.io/jpillora/chisel:{{ .Version }}-amd64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-arm64"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv7"
- "ghcr.io/jpillora/chisel:{{ .Version }}-armv6"
- "ghcr.io/jpillora/chisel:{{ .Version }}-386"
- "ghcr.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "docker.io/jpillora/chisel:{{ .Version }}"
image_templates:
- "docker.io/jpillora/chisel:{{ .Version }}-amd64"
- "docker.io/jpillora/chisel:{{ .Version }}-arm64"
- "docker.io/jpillora/chisel:{{ .Version }}-armv7"
- "docker.io/jpillora/chisel:{{ .Version }}-armv6"
- "docker.io/jpillora/chisel:{{ .Version }}-386"
- "docker.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "docker.io/jpillora/chisel:{{ .Major }}"
skip_push: "{{ if .Prerelease }}true{{ else }}false{{ end }}"
image_templates:
- "docker.io/jpillora/chisel:{{ .Version }}-amd64"
- "docker.io/jpillora/chisel:{{ .Version }}-arm64"
- "docker.io/jpillora/chisel:{{ .Version }}-armv7"
- "docker.io/jpillora/chisel:{{ .Version }}-armv6"
- "docker.io/jpillora/chisel:{{ .Version }}-386"
- "docker.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "docker.io/jpillora/chisel:{{ .Major }}.{{ .Minor }}"
skip_push: "{{ if .Prerelease }}true{{ else }}false{{ end }}"
image_templates:
- "docker.io/jpillora/chisel:{{ .Version }}-amd64"
- "docker.io/jpillora/chisel:{{ .Version }}-arm64"
- "docker.io/jpillora/chisel:{{ .Version }}-armv7"
- "docker.io/jpillora/chisel:{{ .Version }}-armv6"
- "docker.io/jpillora/chisel:{{ .Version }}-386"
- "docker.io/jpillora/chisel:{{ .Version }}-ppc64le"

- name_template: "docker.io/jpillora/chisel:latest"
skip_push: "{{ if .Prerelease }}true{{ else }}false{{ end }}"
image_templates:
- "docker.io/jpillora/chisel:{{ .Version }}-amd64"
- "docker.io/jpillora/chisel:{{ .Version }}-arm64"
- "docker.io/jpillora/chisel:{{ .Version }}-armv7"
- "docker.io/jpillora/chisel:{{ .Version }}-armv6"
- "docker.io/jpillora/chisel:{{ .Version }}-386"
- "docker.io/jpillora/chisel:{{ .Version }}-ppc64le"
70 changes: 26 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: CI
on:
pull_request: {}
push: {}
permissions: write-all
jobs:
# ================
# BUILD AND TEST JOB
Expand All @@ -29,64 +28,47 @@ jobs:
- name: Test
run: go test -v ./...
# ================
# RELEASE BINARIES (on push "v*" tag)
# RELEASE (on push "v*" tag)
# Builds binaries, packages, and multi-arch Docker images via GoReleaser
# ================
release_binaries:
name: Release Binaries
release:
name: Release
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Check out code
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: goreleaser
if: success()
uses: docker://goreleaser/goreleaser:latest
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOTOOLCHAIN: auto
- name: Set up Go
uses: actions/setup-go@v6
with:
args: release --config .github/goreleaser.yml
# ================
# RELEASE DOCKER IMAGES (on push "v*" tag)
# ================
release_docker:
name: Release Docker Images
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
go-version: stable
cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: jpillora
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: jpillora/chisel
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push
uses: docker/build-push-action@v6
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
context: .
file: .github/Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
distribution: goreleaser
version: v2.12.7
args: release --clean --config .github/goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}