-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Labels
kind/taskTasks, chores, etcTasks, chores, etc
Description
Is your task related to a problem? Please describe.
Currently incremental image builds are slow (make image takes a few minutes each run).
Describe the solution you'd like
Use buildkit & cache go modules
# syntax=docker/dockerfile:1
FROM docker.io/library/golang:1.24 AS builder
WORKDIR /src
# Copy go mod files first for better layer caching
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy source and build with caches
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
make argocd-agent
FROM docker.io/library/alpine:latest
COPY --from=builder /src/dist/argocd-agent /bin/argocd-agent
USER 999
ENTRYPOINT ["/bin/argocd-agent"]or, at a minimum run go mod download as a separate layer
FROM docker.io/library/golang:1.24 AS builder
WORKDIR /src
+
+ # Copy go.mod and go.sum first for better layer caching
+ COPY go.mod go.sum ./
+ RUN go mod download
+
+ # Copy source code
COPY . .
+
+ # Build the binary
RUN make argocd-agent
Describe alternatives you've considered
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/taskTasks, chores, etcTasks, chores, etc