Dockerfile.ethereum 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
  2. FROM node:lts-alpine@sha256:2ae9624a39ce437e7f58931a5747fdc60224c6e40f8980db90728de58e22af7c
  3. # npm wants to clone random Git repositories - lovely.
  4. RUN apk add git python make build-base
  5. # Run as user, otherwise, npx explodes.
  6. USER 1000
  7. RUN mkdir -p /home/node/ethereum
  8. RUN mkdir -p /home/node/.npm
  9. WORKDIR /home/node/third_party/pyth/xc-governance-sdk-js/
  10. ADD --chown=node:node third_party/pyth/xc-governance-sdk-js/ .
  11. RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
  12. --mount=type=cache,uid=1000,gid=1000,target=xc_gc_node_modules \
  13. npm install && \
  14. cp -r node_modules node_modules_cache
  15. WORKDIR /home/node/ethereum
  16. # Only invalidate the npm install step if package.json changed
  17. ADD --chown=node:node target-chains/ethereum/package.json .
  18. ADD --chown=node:node target-chains/ethereum/package-lock.json .
  19. # We want to cache node_modules *and* incorporate it into the final image.
  20. RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
  21. --mount=type=cache,uid=1000,gid=1000,target=node_modules \
  22. npm install && \
  23. cp -r node_modules node_modules_cache
  24. # Amusingly, Debian's coreutils version has a bug where mv believes that
  25. # the target is on a different fs and does a full recursive copy for what
  26. # could be a renameat syscall. Alpine does not have this bug.
  27. RUN rm -rf node_modules && mv node_modules_cache node_modules
  28. ADD --chown=node:node target-chains/ethereum/ .
  29. ADD --chown=node:node target-chains/ethereum/.env.test .env