Dockerfile.const 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
  2. FROM docker.io/fedora:34 AS const-build
  3. ARG num_guardians
  4. ENV NUM_GUARDIANS=$num_guardians
  5. # add additional root CAs
  6. COPY cert.pem* /certs/
  7. RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/pki/tls/certs/ca-bundle.crt; fi
  8. # fetch scripts/guardian-set-init.sh deps
  9. RUN dnf -y install jq
  10. # fetch clients/** deps
  11. RUN curl -fsSL https://rpm.nodesource.com/setup_16.x | bash - && dnf -y install nodejs
  12. # configure node & npm to work with custom root CAs
  13. ENV NODE_EXTRA_CA_CERTS=/certs/cert.pem
  14. ENV NODE_OPTIONS=--use-openssl-ca
  15. RUN if [ -e /certs/cert.pem ]; then npm config set cafile /certs/cert.pem; fi
  16. # install token_bridge deps & build
  17. WORKDIR /clients/token_bridge
  18. # copy package.json & package-lock.json by themselves to create a cache layer
  19. COPY clients/token_bridge/package.json clients/token_bridge/package-lock.json ./
  20. # mount the buildkit cache on npm's cache dir, install dependencies
  21. RUN --mount=type=cache,target=/root/.npm npm ci
  22. # copy the rest of the source files, as a layer on top of the deps
  23. COPY clients/token_bridge ./
  24. RUN npm run build
  25. # install nft_bridge deps & build
  26. WORKDIR /clients/nft_bridge
  27. COPY clients/nft_bridge/package.json clients/nft_bridge/package-lock.json ./
  28. RUN --mount=type=cache,target=/root/.npm npm ci
  29. COPY clients/nft_bridge ./
  30. RUN npm run build
  31. WORKDIR /
  32. COPY scripts ./scripts
  33. COPY ethereum/.env.test ./ethereum/.env.test
  34. # run guardian-set-init.sh to create env files with the init state for NUM_GUARDIANS
  35. RUN ./scripts/guardian-set-init.sh $NUM_GUARDIANS
  36. FROM scratch AS const-export
  37. COPY --from=const-build /scripts/.env.0x ethereum/.env
  38. COPY --from=const-build /scripts/.env.hex solana/.env
  39. COPY --from=const-build /scripts/.env.hex terra/tools/.env
  40. COPY --from=const-build /scripts/.env.hex algorand/.env