Dockerfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
  2. FROM docker.io/golang:1.23.3-bullseye@sha256:9e53abacfc22cd3df3e4ebcc04ac64951b71d2a38c52b690f3807af6a2000ed2 AS dev
  3. FROM dev AS build
  4. WORKDIR /app
  5. COPY node/tools tools
  6. RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
  7. cd tools/ && go build -mod=readonly -o /dlv github.com/go-delve/delve/cmd/dlv
  8. COPY node node
  9. COPY sdk sdk
  10. COPY wormchain wormchain
  11. ARG GO_BUILD_ARGS=-race
  12. RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
  13. export CGO_ENABLED=1 && \
  14. cd node && \
  15. go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /guardiand github.com/certusone/wormhole/node && \
  16. go get github.com/CosmWasm/wasmvm@v1.1.1 && \
  17. cp /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.1.1/internal/api/libwasmvm.*.so /usr/lib/
  18. # Only export the final binary (+ shared objects). This reduces the image size
  19. # from ~1GB to ~150MB.
  20. FROM scratch as export
  21. # guardiand can't (easily) be statically linked due to the C dependencies, so we
  22. # have to copy all the dynamic libraries
  23. COPY --from=build /lib/* /lib/
  24. COPY --from=build /lib64/* /lib64/
  25. COPY --from=build /usr/lib/libwasmvm.*.so /usr/lib/
  26. # Copy the shells as entrypoints, but no utilities are necessary
  27. COPY --from=build /bin/bash /bin/dash /bin/sh /bin/
  28. # finally copy the guardian executable
  29. COPY --from=build /guardiand .
  30. ENTRYPOINT ["/guardiand"]