Dockerfile.pyth_relay 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. FROM node:16-alpine@sha256:72a490e7ed8aed68e16b8dc8f37b5bcc35c5b5c56ee3256effcdee63e2546f93
  2. ARG P2W_BASE_PATH=/usr/src/pyth2wormhole
  3. RUN apk --no-cache --update add python3 build-base # Needed by the Ethereum build
  4. WORKDIR ${P2W_BASE_PATH}
  5. RUN addgroup -S pyth -g 10001 && adduser -S pyth -G pyth -u 10001
  6. RUN chown -R pyth:pyth .
  7. USER pyth
  8. WORKDIR ${P2W_BASE_PATH}/ethereum
  9. ADD --chown=pyth:pyth ethereum .
  10. RUN npm install && npm run build
  11. USER root
  12. RUN apk del build-base # No longer needed after EVM build
  13. USER pyth
  14. # Adds p2w-sdk/js dependency
  15. ARG P2W_SDK_REL_PATH=third_party/pyth/p2w-sdk/js
  16. WORKDIR ${P2W_BASE_PATH}/${P2W_SDK_REL_PATH}
  17. ADD --chown=pyth:pyth ${P2W_SDK_REL_PATH} .
  18. RUN npm ci && npm run build && npm cache clean --force
  19. # Add the code and compile
  20. ARG P2W_RELAY_REL_PATH=third_party/pyth/p2w-relay
  21. WORKDIR ${P2W_BASE_PATH}/${P2W_RELAY_REL_PATH}
  22. ADD --chown=pyth:pyth ${P2W_RELAY_REL_PATH} .
  23. RUN npm ci && npm run build && npm cache clean --force
  24. # If you are building for production
  25. # RUN npm ci --only=production
  26. RUN mkdir -p ${P2W_BASE_PATH}/${P2W_RELAY_REL_PATH}/logs