Dockerfile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # This is a multi-stage docker file:
  2. # 1. The first stage builds the contracts
  3. # 2. The second is an empty image with only the wasm files (useful for exporting)
  4. # 3. The third creates a node.js environment to deploy the contracts to devnet
  5. FROM cosmwasm/workspace-optimizer:0.12.6@sha256:e6565a5e87c830ef3e8775a9035006b38ad0aaf0a96319158c802457b1dd1d08 AS builder
  6. COPY Cargo.lock /code/
  7. COPY Cargo.toml /code/
  8. COPY contracts /code/contracts
  9. # Support additional root CAs
  10. COPY README.md cert.pem* /certs/
  11. # Alpine
  12. RUN if [ -e /certs/cert.pem ]; then cp /certs/cert.pem /etc/ssl/cert.pem; fi
  13. RUN --mount=type=cache,target=/code/target,id=cosmwasm_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh
  14. FROM scratch as artifacts
  15. COPY --from=builder /code/artifacts /
  16. # Contract deployment stage
  17. FROM node:16-buster-slim@sha256:93c9fc3550f5f7d159f282027228e90e3a7f8bf38544758024f005e82607f546
  18. # Support additional root CAs
  19. COPY README.md cert.pem* /certs/
  20. # Node
  21. ENV NODE_EXTRA_CA_CERTS=/certs/cert.pem
  22. ENV NODE_OPTIONS=--use-openssl-ca
  23. # npm
  24. RUN if [ -e /certs/cert.pem ]; then npm config set cafile /certs/cert.pem; fi
  25. RUN apt update && apt install netcat curl jq -y
  26. WORKDIR /app/tools
  27. COPY --from=artifacts / /app/artifacts
  28. COPY ./artifacts/cw20_base.wasm /app/artifacts/
  29. COPY ./tools/package.json ./tools/package-lock.json /app/tools/
  30. RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
  31. npm ci
  32. COPY ./tools /app/tools