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
37 changes: 35 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
# Version control
.git
.gitignore

# Documentation
*.md
docs/

# Tests
*_test.go
internal/testhelpers
internal/tests

# Development
.env
.env.*
*.log
skaffold.yaml
skaffold.example.env

# Build artifacts
bin/
helm/
internal/demo

# IDE
.vscode
.idea
*.swp

# CI/CD
.github
.goreleaser.yml
.goreleaser.main.yml

# Go
go.work
go.work.sum
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
check-latest: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
Expand All @@ -51,6 +51,7 @@ jobs:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILDKIT_INLINE_CACHE: 1

helm:
needs: release
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,25 @@ jobs:
- name: Build worker-controller image
run: |
skaffold build --profile worker-controller --push=false
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain

- name: Build helloworld worker image
run: |
skaffold build --profile helloworld-worker --push=false
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain

# Verify that the demo worker patch applies successfully and builds.
- name: Build helloworld worker image patch
run: |
git apply internal/demo/helloworld/changes/no-version-gate.patch
skaffold build --profile helloworld-worker --push=false
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain

test-integration:
name: Run Integration Tests
Expand Down
4 changes: 4 additions & 0 deletions .goreleaser.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/amd64
- --cache-from=type=gha,scope=amd64
- --cache-to=type=gha,mode=max,scope=amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description=Temporal Worker Controller for Kubernetes
- --label=org.opencontainers.image.url=https://github.com/temporalio/temporal-worker-controller
Expand All @@ -63,6 +65,8 @@ dockers:
use: buildx
build_flag_templates:
- --platform=linux/arm64
- --cache-from=type=gha,scope=arm64
- --cache-to=type=gha,mode=max,scope=arm64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description=Temporal Worker Controller for Kubernetes
- --label=org.opencontainers.image.url=https://github.com/temporalio/temporal-worker-controller
Expand Down
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# Build the manager binary
FROM golang:1.25 AS builder
ARG TARGETOS
ARG TARGETARCH

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download

COPY cmd/main.go cmd/main.go
COPY api/ api/
COPY internal/k8s internal/k8s
Expand All @@ -20,7 +15,6 @@ COPY internal/controller internal/controller
COPY internal/planner internal/planner
COPY internal/defaults internal/defaults

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM gcr.io/distroless/static-debian12:nonroot

COPY temporal-worker-controller /usr/local/bin/temporal-worker-controller
WORKDIR /app

COPY --chown=nonroot:nonroot temporal-worker-controller /usr/local/bin/temporal-worker-controller

USER nonroot

ENTRYPOINT ["temporal-worker-controller"]
1 change: 1 addition & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ profiles:
context: .
docker:
dockerfile: Dockerfile
useBuildkit: true
manifests:
helm:
releases:
Expand Down
Loading