Skip to content

Commit

Permalink
improve setting C_COMPILER
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarak Ben Youssef committed Jan 10, 2024
1 parent e83f95f commit 0a57ef5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/emulator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ COPY . .

ARG TARGETOS
ARG TARGETARCH
ARG C_COMPILER
RUN if [ "$TARGETARCH" = "arm64" ] ; then C_COMPILER="arm-linux-gnueabi-gcc" ; else C_COMPILER="gcc" ; fi

ARG C_COMPILER=""
RUN if [ "$TARGETARCH" = "arm64" ] ; then C_COMPILER="arm-linux-gnueabi-gcc" ; \
elif [ "$TARGETARCH" = "amd64" ] ; then C_COMPILER="gcc" ; fi
RUN --mount=type=ssh \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
GO111MODULE=on CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
CC=$C_COMPILER \
GO111MODULE=on CGO_ENABLED=1 GOOS=$TARGETOS \
GOARCH=$TARGETARCH CC=$C_COMPILER \
go build -ldflags "-extldflags -static" -o ./app ./cmd/emulator

## Add the binary to a fresh distroless image
Expand Down

0 comments on commit 0a57ef5

Please # to comment.