-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying two things: - speed up arm build by allowing cross-comp from go instead of slow QEMU - take a stab at caching buildx layers, without infinite growth This fix was laready applied in ipfs-inactive/bifrost-gateway@14cfa48 and reduced build time from 20m to 3m.
- Loading branch information
Showing
2 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
FROM golang:1.19.1-buster | ||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19.1-buster | ||
LABEL maintainer="Steven Allen <[email protected]>" | ||
|
||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
# Install deps | ||
RUN apt-get update && apt-get install -y \ | ||
libssl-dev \ | ||
|
@@ -24,7 +29,7 @@ ARG IPFS_PLUGINS | |
# Also: fix getting HEAD commit hash via git rev-parse. | ||
RUN cd $SRC_DIR \ | ||
&& mkdir -p .git/objects \ | ||
&& GOFLAGS=-buildvcs=false make build GOTAGS=openssl IPFS_PLUGINS=$IPFS_PLUGINS | ||
&& GOOS=$TARGETOS GOARCH=$TARGETARCH GOFLAGS=-buildvcs=false make build GOTAGS=openssl IPFS_PLUGINS=$IPFS_PLUGINS | ||
|
||
# Get su-exec, a very minimal tool for dropping privileges, | ||
# and tini, a very minimal init daemon for containers | ||
|
@@ -46,7 +51,7 @@ RUN set -eux; \ | |
&& chmod +x tini | ||
|
||
# Now comes the actual target image, which aims to be as small as possible. | ||
FROM busybox:1.31.1-glibc | ||
FROM --platform=${BUILDPLATFORM:-linux/amd64} busybox:1.31.1-glibc | ||
LABEL maintainer="Steven Allen <[email protected]>" | ||
|
||
# Get the ipfs binary, entrypoint script, and TLS CAs from the build container. | ||
|