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
40 changes: 37 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
.github
# Build artifacts
runner
worker

# Version control
.git
.gitignore

# CI/CD
.github
.gitlab-ci.yml

# Documentation
*.md
README*
docs/

# Tests
*_test.go
**/*_test.go

# Development
.env
.env.*
*.log

# IDE
.vscode/
.idea/
*.swp
*.swo
.DS_Store

# Kubernetes/Deployment
charts/
deployment.yaml
runner
worker
kubernetes/

# Project-specific
Makefile
22 changes: 8 additions & 14 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,44 @@
name: Docker

on:
push:
branches: [ "main" ]
branches: ["main"]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: ['v*.*.*']
pull_request:
branches: [ "main" ]

branches: ["main"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2.4.1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# Build stage
FROM golang:1.23 AS builder

WORKDIR /usr/src/worker

# Copy dependency manifests
COPY go.mod go.sum ./
RUN go mod download && go mod verify

# Install dependencies
RUN --mount=type=cache,target=/go/pkg/mod go mod download && go mod verify

# Copy source code
COPY . .
RUN CGO_ENABLED=0 go build -v -o /usr/local/bin/worker ./cmd/worker
RUN CGO_ENABLED=0 go build -v -o /usr/local/bin/runner ./cmd/runner

# Build binaries
RUN CGO_ENABLED=0 go build -v -o /usr/local/bin/worker ./cmd/worker && \
CGO_ENABLED=0 go build -v -o /usr/local/bin/runner ./cmd/runner

# Runtime stage
FROM scratch

# Copy binaries from builder
COPY --from=builder /usr/local/bin/worker /usr/local/bin/worker
COPY --from=builder /usr/local/bin/runner /usr/local/bin/runner

Expand Down
Loading