Skip to content

Commit b9e0da6

Browse files
pratikbinpratikbin
authored andcommitted
dockerfile: move TARGET* args for fast workflow & ... (#993)
- Single COPY step for go mod and sum - Use ENV GOOS & GOARCH from TARGET* args Co-authored-by: pratikbin <[email protected]>
1 parent b6553be commit b9e0da6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Dockerfile

+5-8
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,21 @@ FROM --platform=$BUILDPLATFORM golang:1.18-alpine as BUILD
22

33
WORKDIR /relayer
44

5-
ARG TARGETARCH
6-
ARG TARGETOS
7-
85
# Update and install needed deps prioir to installing the binary.
96
RUN apk update && \
10-
apk --no-cache add make git build-base
7+
apk --no-cache add make git build-base
118

129
# Copy go.mod and go.sum first and download for caching go modules
13-
COPY go.mod go.mod
14-
COPY go.sum go.sum
10+
COPY go.mod go.sum ./
1511

1612
RUN go mod download
1713

1814
# Copy the files from host
1915
COPY . .
2016

21-
RUN export GOOS=${TARGETOS} GOARCH=${TARGETARCH} && \
22-
make install
17+
ARG TARGETARCH TARGETOS
18+
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
19+
RUN make install
2320

2421
FROM alpine:latest
2522

0 commit comments

Comments
 (0)