2021-12-12 02:57:20 -08:00
|
|
|
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
|
2022-07-10 17:47:10 -07:00
|
|
|
FROM --platform=linux/amd64 docker.io/golang:1.17.5@sha256:90d1ab81f3d157ca649a9ff8d251691b810d95ea6023a03cdca139df58bca599 AS build
|
|
|
|
# libwasmvm.so is not compatible with arm
|
2020-08-03 10:47:22 -07:00
|
|
|
|
2022-02-28 12:48:50 -08:00
|
|
|
# Support additional root CAs
|
2022-06-22 03:06:35 -07:00
|
|
|
COPY node/go.mod cert.pem* /certs/
|
2022-02-28 12:48:50 -08:00
|
|
|
# Debian
|
|
|
|
RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/certs/ca-certificates.crt; fi
|
2022-04-29 12:56:08 -07:00
|
|
|
# git
|
|
|
|
RUN if [ -e /certs/cert.pem ]; then git config --global http.sslCAInfo /certs/cert.pem; fi
|
2022-02-28 12:48:50 -08:00
|
|
|
|
2020-08-03 10:47:22 -07:00
|
|
|
WORKDIR /app
|
|
|
|
|
2022-06-22 03:06:35 -07:00
|
|
|
COPY node/tools tools
|
2020-10-22 03:20:11 -07:00
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
|
2020-10-28 14:41:38 -07:00
|
|
|
cd tools/ && go build -mod=readonly -o /dlv github.com/go-delve/delve/cmd/dlv
|
2020-10-22 03:20:11 -07:00
|
|
|
|
2022-06-22 03:06:35 -07:00
|
|
|
COPY node node
|
2022-08-18 01:52:36 -07:00
|
|
|
COPY sdk sdk
|
2020-08-03 10:47:22 -07:00
|
|
|
|
2022-07-06 11:27:49 -07:00
|
|
|
ARG GO_BUILD_ARGS=-race
|
|
|
|
|
2020-08-17 09:20:15 -07:00
|
|
|
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
|
2022-06-22 03:06:35 -07:00
|
|
|
cd node && \
|
2022-09-29 19:02:54 -07:00
|
|
|
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-extldflags "-Wl,--allow-multiple-definition" -X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /guardiand github.com/certusone/wormhole/node
|
2020-08-03 10:47:22 -07:00
|
|
|
|
2022-07-06 11:27:49 -07:00
|
|
|
# Only export the final binary (+ shared objects). This reduces the image size
|
|
|
|
# from ~1GB to ~150MB.
|
|
|
|
FROM scratch as export
|
|
|
|
|
|
|
|
# guardiand can't (easily) be statically linked due to the C dependencies, so we
|
|
|
|
# have to copy all the dynamic libraries
|
|
|
|
COPY --from=build /bin/* /bin/
|
|
|
|
COPY --from=build /lib/* /lib/
|
|
|
|
COPY --from=build /lib64/* /lib64/
|
|
|
|
|
|
|
|
# finally copy the guardian executable
|
|
|
|
COPY --from=build /guardiand .
|
|
|
|
|
|
|
|
ENTRYPOINT ["/guardiand"]
|