Skip to content
Merged
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
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# dirs
.git
.github
.claude
.idea
docs

# files
.env*
*.md
.goreleaser.yaml
docker-compose*.yml
LICENSE
LICENSE.md
version.json
244 changes: 244 additions & 0 deletions .github/workflows/publish-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
name: Container

on:
push:
branches:
- main
tags:
- 'v*'
workflow_run:
workflows: [Releaser]
types:
- completed
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
# PR Build Check — validate Dockerfile compiles, single platform, no push
build-check:
if: github.event_name == 'pull_request'
name: Build Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build prod (amd64 only, no push)
uses: docker/build-push-action@v6
with:
context: .
push: false
platforms: linux/amd64
cache-from: type=gha
build-args: |
VERSION=pr-${{ github.event.pull_request.number }}
COMMIT=${{ github.event.pull_request.head.sha }}
DATE=${{ github.event.pull_request.updated_at }}
BUILT_BY=ghcr-pr

- name: Build dev (amd64 only, no push)
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.dev
push: false
platforms: linux/amd64
cache-from: type=gha,scope=dev
build-args: |
VERSION=pr-${{ github.event.pull_request.number }}
COMMIT=${{ github.event.pull_request.head.sha }}
DATE=${{ github.event.pull_request.updated_at }}
BUILT_BY=ghcr-pr-dev

# Extract release ref from Releaser workflow artifacts
prepare-checkout:
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
name: Prepare ref
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.releaser.outputs.version }}
steps:
- name: Get ref from Releaser
id: releaser
uses: ipdxco/unified-github-workflows/.github/actions/inspect-releaser@v1.0
with:
artifacts-url: ${{ github.event.workflow_run.artifacts_url }}

# Publish on push to main branch
publish-main:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Publish (main)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=main
type=sha,prefix=sha-,format=short

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=main
COMMIT=${{ github.sha }}
DATE=${{ github.event.head_commit.timestamp }}
BUILT_BY=ghcr-main

# Publish dev container on push to main — adds delve + randdir + diagnostic tools
publish-main-dev:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Publish dev (main)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

# Dockerfile.dev's runtime stage uses debian and runs apt-get, so the
# arm64 build needs QEMU. (The prod Dockerfile avoids this because its
# runtime stage has no RUN commands.)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=main-dev
type=sha,prefix=sha-,suffix=-dev,format=short

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.dev
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=dev
cache-to: type=gha,mode=max,scope=dev
build-args: |
VERSION=main
COMMIT=${{ github.sha }}
DATE=${{ github.event.head_commit.timestamp }}
BUILT_BY=ghcr-main-dev

# Publish on release tag (v*) — direct push or via Releaser
publish-release:
name: Publish (release)
needs: [prepare-checkout]
# always() allows running even when prepare-checkout was skipped (direct tag push)
if: |
always() && !cancelled() && !failure() &&
((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'))
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Determine ref
id: ref
run: |
if [ "${{ github.event_name }}" = "workflow_run" ]; then
echo "ref=${{ needs.prepare-checkout.outputs.ref }}" >> $GITHUB_OUTPUT
else
echo "ref=${{ github.ref }}" >> $GITHUB_OUTPUT
fi

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}

- name: Extract build metadata from git
id: buildmeta
run: |
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "date=$(git log -1 --format=%cI)" >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ steps.ref.outputs.ref }},match=v([0-9].*)

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=v${{ steps.meta.outputs.version }}
COMMIT=${{ steps.buildmeta.outputs.commit }}
DATE=${{ steps.buildmeta.outputs.date }}
BUILT_BY=ghcr-release
13 changes: 1 addition & 12 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

permissions:
contents: write
packages: write

jobs:
bin-releaser:
Expand All @@ -24,17 +23,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: "1.25.x"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Release Binaries and Containers
- name: Release Binaries
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
Expand Down
35 changes: 0 additions & 35 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,38 +50,3 @@ release:

changelog:
disable: true

dockers:
# AMD64 image
- image_templates:
- "ghcr.io/storacha/guppy:{{ .Version }}-amd64"
dockerfile: Dockerfile.release
use: buildx
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
goarch: amd64

# ARM64 image
- image_templates:
- "ghcr.io/storacha/guppy:{{ .Version }}-arm64"
dockerfile: Dockerfile.release
use: buildx
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
goarch: arm64

docker_manifests:
- name_template: "ghcr.io/storacha/guppy:{{ .Version }}"
image_templates:
- "ghcr.io/storacha/guppy:{{ .Version }}-amd64"
- "ghcr.io/storacha/guppy:{{ .Version }}-arm64"
Loading
Loading