Commit ac49af2c authored by Will Cory's avatar Will Cory

feat: make dockerfile more maintainable

🐛 delete copy paste pasta

🔥 delete useless comment

🎨 delete accidental new line at top of file

🐛 Accidentally nuked integration-tests/package.json which wasn't in packages dir

📝 📝 update a package

Change sdk to force build
parent fee73047
# This Dockerfile builds all the dependencies needed by the monorepo, and should # This Dockerfile builds all the dependencies needed by the monorepo, and should
# be used to build any of the follow-on services # be used to build any of the follow-on services
# #
# ### BASE: Install deps
# ░██████╗████████╗░█████╗░░██████╗░███████╗  ░█████╗░
# ██╔════╝╚══██╔══╝██╔══██╗██╔════╝░██╔════╝  ██╔══██╗
# ╚█████╗░░░░██║░░░███████║██║░░██╗░█████╗░░  ██║░░██║
# ░╚═══██╗░░░██║░░░██╔══██║██║░░╚██╗██╔══╝░░  ██║░░██║
# ██████╔╝░░░██║░░░██║░░██║╚██████╔╝███████╗  ╚█████╔╝
# ╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░╚═════╝░╚══════╝  ░╚════╝░
# Stage 0 (named `manifests`) collects
# dependency manifest files (`package.json` and `yarn.lock`) which are then
# used by stage 1 to install these dependencies
# development. The only reason we need a separate stage just for collecting the
# dependency manifests is that Docker's `COPY` command still does not allow
# copying based on a glob pattern (see this GitHub issue for more details
# https://github.com/moby/moby/issues/15858). Being able to copy only manifests
# into stage 1 (the `COPY --from=manifests` statement) is important to maximize
# Docker build cache hit rate. `alpine` is chosen as the base image for the
# first stage because it's the smallest image that have access to the `cp
# --parents -t` command (by installing the `coreutils` package).
FROM alpine:3.16 as manifests
RUN apk add coreutils
WORKDIR /tmp
COPY yarn.lock .nvmrc package.json ./src/
COPY packages src/packages/
RUN mkdir manifests && \
cd src && \
# copy package.json recursively
find . -name 'package.json' | xargs cp --parents -t ../manifests/ && \
# yarn.lock
cp yarn.lock ../manifests/ && \
# .nvmrc
cp .nvmrc ../manifests/
# ░██████╗████████╗░█████╗░░██████╗░███████╗  ░░███╗░░
# ██╔════╝╚══██╔══╝██╔══██╗██╔════╝░██╔════╝  ░████║░░
# ╚█████╗░░░░██║░░░███████║██║░░██╗░█████╗░░  ██╔██║░░
# ░╚═══██╗░░░██║░░░██╔══██║██║░░╚██╗██╔══╝░░  ╚═╝██║░░
# ██████╔╝░░░██║░░░██║░░██║╚██████╔╝███████╗  ███████╗
# ╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░╚═════╝░╚══════╝  ╚══════╝
# ██╗███╗░░██╗░██████╗████████╗░█████╗░██╗░░░░░██╗░░░░░  ██████╗░███████╗██████╗░░██████╗
# ██║████╗░██║██╔════╝╚══██╔══╝██╔══██╗██║░░░░░██║░░░░░  ██╔══██╗██╔════╝██╔══██╗██╔════╝
# ██║██╔██╗██║╚█████╗░░░░██║░░░███████║██║░░░░░██║░░░░░  ██║░░██║█████╗░░██████╔╝╚█████╗░
# ██║██║╚████║░╚═══██╗░░░██║░░░██╔══██║██║░░░░░██║░░░░░  ██║░░██║██╔══╝░░██╔═══╝░░╚═══██╗
# ██║██║░╚███║██████╔╝░░░██║░░░██║░░██║███████╗███████╗  ██████╔╝███████╗██║░░░░░██████╔╝
# ╚═╝╚═╝░░╚══╝╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝╚══════╝╚══════╝  ╚═════╝░╚══════╝╚═╝░░░░░╚═════╝░
FROM ethereumoptimism/foundry:latest as foundry FROM ethereumoptimism/foundry:latest as foundry
FROM node:16-alpine3.14 as base FROM node:16-alpine3.14 as base
# Base: install deps
RUN apk --no-cache add curl \ RUN apk --no-cache add curl \
jq \ jq \
python3 \ python3 \
...@@ -33,32 +79,32 @@ COPY --from=foundry /usr/local/bin/cast /usr/local/bin/cast ...@@ -33,32 +79,32 @@ COPY --from=foundry /usr/local/bin/cast /usr/local/bin/cast
# note: this approach can be a bit unhandy to maintain, but it allows # note: this approach can be a bit unhandy to maintain, but it allows
# us to cache the installation steps # us to cache the installation steps
WORKDIR /opt/optimism WORKDIR /opt/optimism
COPY *.json yarn.lock ./
COPY packages/sdk/package.json ./packages/sdk/package.json # Copy manifest files into the image in
COPY packages/actor-tests/package.json ./packages/actor-tests/package.json # preparation for `yarn install`.
COPY packages/core-utils/package.json ./packages/core-utils/package.json
COPY packages/common-ts/package.json ./packages/common-ts/package.json
COPY packages/contracts/package.json ./packages/contracts/package.json
COPY packages/contracts-bedrock/package.json ./packages/contracts-bedrock/package.json
COPY packages/contracts-periphery/package.json ./packages/contracts-periphery/package.json
COPY packages/data-transport-layer/package.json ./packages/data-transport-layer/package.json
COPY packages/hardhat-deploy-config/package.json ./packages/hardhat-deploy-config/package.json
COPY packages/message-relayer/package.json ./packages/message-relayer/package.json
COPY packages/fault-detector/package.json ./packages/fault-detector/package.json
COPY packages/replica-healthcheck/package.json ./packages/replica-healthcheck/package.json
COPY packages/chain-mon/package.json ./packages/chain-mon/package.json
COPY packages/balance-monitor/package.json ./packages/balance-monitor/package.json
COPY packages/two-step-monitor/package.json ./packages/two-step-monitor/package.json
COPY integration-tests/package.json ./integration-tests/package.json COPY integration-tests/package.json ./integration-tests/package.json
COPY --from=manifests /tmp/manifests ./
COPY *.json ./
RUN yarn install --frozen-lockfile && yarn cache clean RUN yarn install --frozen-lockfile && yarn cache clean
# ██████╗░██╗░░░██╗██╗██╗░░░░░██████╗░
# ██╔══██╗██║░░░██║██║██║░░░░░██╔══██╗
# ██████╦╝██║░░░██║██║██║░░░░░██║░░██║
# ██╔══██╗██║░░░██║██║██║░░░░░██║░░██║
# ██████╦╝╚██████╔╝██║███████╗██████╔╝
# ╚═════╝░░╚═════╝░╚═╝╚══════╝╚═════╝░
COPY ./packages ./packages COPY ./packages ./packages
COPY ./integration-tests ./integration-tests COPY ./integration-tests ./integration-tests
# build it!
RUN yarn build RUN yarn build
#j███████╗██╗███╗░░██╗░█████╗░██╗░░░░░  ██╗███╗░░░███╗░█████╗░░██████╗░███████╗░██████╗
#j██╔════╝██║████╗░██║██╔══██╗██║░░░░░  ██║████╗░████║██╔══██╗██╔════╝░██╔════╝██╔════╝
#j█████╗░░██║██╔██╗██║███████║██║░░░░░  ██║██╔████╔██║███████║██║░░██╗░█████╗░░╚█████╗░
#j██╔══╝░░██║██║╚████║██╔══██║██║░░░░░  ██║██║╚██╔╝██║██╔══██║██║░░╚██╗██╔══╝░░░╚═══██╗
#j██║░░░░░██║██║░╚███║██║░░██║███████╗  ██║██║░╚═╝░██║██║░░██║╚██████╔╝███████╗██████╔╝
#j╚═╝░░░░░╚═╝╚═╝░░╚══╝╚═╝░░╚═╝╚══════╝  ╚═╝╚═╝░░░░░╚═╝╚═╝░░╚═╝░╚═════╝░╚══════╝╚═════╝░
FROM base as actor-tests-bedrock FROM base as actor-tests-bedrock
WORKDIR /opt/optimism/packages/actor-tests WORKDIR /opt/optimism/packages/actor-tests
ENTRYPOINT ["yarn", "run:bedrock"] ENTRYPOINT ["yarn", "run:bedrock"]
......
...@@ -1014,6 +1014,7 @@ export class CrossChainMessenger { ...@@ -1014,6 +1014,7 @@ export class CrossChainMessenger {
* Queries the OptimismPortal contract's `provenWithdrawals` mapping * Queries the OptimismPortal contract's `provenWithdrawals` mapping
* for a ProvenWithdrawal that matches the passed withdrawalHash * for a ProvenWithdrawal that matches the passed withdrawalHash
* *
* @bedrock
* Note: This function is bedrock-specific. * Note: This function is bedrock-specific.
* *
* @returns A ProvenWithdrawal object * @returns A ProvenWithdrawal object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment