Skip to content

Commit

Permalink
Merge pull request #548 from onflow/tarak/fix-build
Browse files Browse the repository at this point in the history
Specify C compiler in build cross-compilation
  • Loading branch information
tarakby authored and jribbink committed Mar 7, 2024
1 parent 783d456 commit 4d6a380
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 56 deletions.
12 changes: 11 additions & 1 deletion cmd/emulator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,25 @@ WORKDIR /app
# add the pubkey of github.com to knownhosts, so ssh-agent doesn't bark
RUN mkdir -p /root/.ssh && ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts
RUN git config --global 'url.ssh://git@github.com/.insteadOf' https://github.com/
RUN apt-get update && apt-get -y install apt-utils gcc-aarch64-linux-gnu

COPY . .

ARG TARGETOS
ARG TARGETARCH
ENV GO111MODULE=on \
CGO_ENABLED=1 \
CGO_FLAGS="-O2 -D__BLST_PORTABLE__" \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH
RUN --mount=type=ssh \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
GO111MODULE=on CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
if [ "$TARGETARCH" = "arm64" ] ; then \
export CC=aarch64-linux-gnu-gcc; \
elif [ "$TARGETARCH" = "amd64" ] ; then \
export CC=x86_64-linux-gnu-gcc; \
fi; \
go build -ldflags "-extldflags -static" -o ./app ./cmd/emulator

## Add the binary to a fresh distroless image
Expand Down
55 changes: 0 additions & 55 deletions cmd/emulator/Dockerfile.relic

This file was deleted.

0 comments on commit 4d6a380

Please # to comment.