Skip to content

Commit

Permalink
Better docker build caching
Browse files Browse the repository at this point in the history
This will cache dependencies between docker builds.

Signed-off-by: Matej Vašek <matejvasek@gmail.com>
  • Loading branch information
matejvasek committed Aug 26, 2024
1 parent 91fd4c1 commit e892963
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Dockerfile.utils
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETARCH

WORKDIR /workspace

COPY go.mod go.sum ./
RUN go mod download -x

COPY . .

RUN GOARCH=$TARGETARCH go build -o func-util -trimpath -ldflags '-w -s' ./cmd/func-util
Expand All @@ -16,7 +21,7 @@ RUN apk add --no-cache socat tar \
&& addgroup func -g 1000 \
&& adduser func -u 1001 -D -G func

COPY --from=builder /go/func-util /usr/local/bin/
COPY --from=builder /workspace/func-util /usr/local/bin/
RUN ln -s /usr/local/bin/func-util /usr/local/bin/deploy && \
ln -s /usr/local/bin/func-util /usr/local/bin/scaffold

Expand Down

0 comments on commit e892963

Please sign in to comment.