Skip to content

Commit

Permalink
dockerfile: move TARGET* args for fast workflow & ... (cosmos#993)
Browse files Browse the repository at this point in the history
- Single COPY step for go mod and sum
- Use ENV GOOS & GOARCH from TARGET* args

Co-authored-by: pratikbin <pratikbin+010101@no-reply-git.luolix.top>
  • Loading branch information
2 people authored and TxCorpi0x committed Oct 7, 2022
1 parent 66a8b3a commit 9de06c8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ FROM --platform=$BUILDPLATFORM golang:1.18-alpine as BUILD

WORKDIR /relayer

ARG TARGETARCH
ARG TARGETOS

# Update and install needed deps prioir to installing the binary.
RUN apk update && \
apk --no-cache add make git build-base
apk --no-cache add make git build-base

# Copy go.mod and go.sum first and download for caching go modules
COPY go.mod go.mod
COPY go.sum go.sum
COPY go.mod go.sum ./

RUN go mod download

# Copy the files from host
COPY . .

RUN export GOOS=${TARGETOS} GOARCH=${TARGETARCH} && \
make install
ARG TARGETARCH TARGETOS
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
RUN make install

FROM alpine:latest

Expand Down

0 comments on commit 9de06c8

Please sign in to comment.