Dockerfile.const 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/js
  18. # copy package.json & package-lock.json by themselves to create a cache layer
  19. COPY clients/js/package.json clients/js/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/js ./
  24. WORKDIR /
  25. COPY scripts ./scripts
  26. COPY ethereum/.env.test ./ethereum/.env.test
  27. # run guardian-set-init.sh to create env files with the init state for NUM_GUARDIANS
  28. RUN ./scripts/guardian-set-init.sh $NUM_GUARDIANS
  29. FROM scratch AS const-export
  30. COPY --from=const-build /scripts/.env.0x ethereum/.env
  31. COPY --from=const-build /scripts/.env.hex solana/.env
  32. COPY --from=const-build /scripts/.env.hex terra/tools/.env
  33. COPY --from=const-build /scripts/.env.hex cosmwasm/tools/.env
  34. COPY --from=const-build /scripts/.env.hex algorand/.env