Commit 1e99340f authored by Matthew Slipper's avatar Matthew Slipper Committed by Kelvin Fichter

integration-tests: Single dockerfile

parent fe7070ce
...@@ -37,24 +37,6 @@ jobs: ...@@ -37,24 +37,6 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-
- uses: actions/cache@v2
name: Set up layer cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-1-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-1-
- uses: docker/setup-buildx-action@master
name: Set up Docker Buildx
id: buildx
with:
version: latest
driver-opts: image=moby/buildkit:master,network=host
- name: Build the services
run: ./ops/scripts/build-ci.sh
- name: Bring the stack up - name: Bring the stack up
working-directory: ./ops working-directory: ./ops
run: | run: |
...@@ -73,7 +55,7 @@ jobs: ...@@ -73,7 +55,7 @@ jobs:
if: failure() if: failure()
uses: jwalton/gh-docker-logs@v1 uses: jwalton/gh-docker-logs@v1
with: with:
images: 'ethereumoptimism/builder,ethereumoptimism/hardhat,ethereumoptimism/deployer,ethereumoptimism/data-transport-layer,ethereumoptimism/l2geth,ethereumoptimism/message-relayer,ethereumoptimism/batch-submitter,ethereumoptimism/l2geth,ethereumoptimism/integration-tests' images: 'ethereumoptimism/hardhat,ops_deployer,ops_dtl,ethereumoptimism/l2geth,ethereumoptimism/message-relayer,ops_batch_submitter,ethereumoptimism/l2geth,ops_integration_tests'
dest: '/home/runner/logs' dest: '/home/runner/logs'
- name: Tar logs - name: Tar logs
...@@ -86,11 +68,3 @@ jobs: ...@@ -86,11 +68,3 @@ jobs:
with: with:
name: logs.tgz name: logs.tgz
path: ./logs.tgz path: ./logs.tgz
# Needed to address the following bugs:
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
...@@ -8,7 +8,7 @@ import { serialize } from '@ethersproject/transactions' ...@@ -8,7 +8,7 @@ import { serialize } from '@ethersproject/transactions'
import { predeploys, getContractFactory } from '@eth-optimism/contracts' import { predeploys, getContractFactory } from '@eth-optimism/contracts'
/* Imports: Internal */ /* Imports: Internal */
import { isLiveNetwork } from './shared/utils' import {gasPriceForL2, isLiveNetwork} from './shared/utils'
import { OptimismEnv } from './shared/env' import { OptimismEnv } from './shared/env'
import { Direction } from './shared/watcher-utils' import { Direction } from './shared/watcher-utils'
...@@ -175,10 +175,12 @@ describe('Fee Payment Integration Tests', async () => { ...@@ -175,10 +175,12 @@ describe('Fee Payment Integration Tests', async () => {
// Submit the withdrawal. // Submit the withdrawal.
const withdrawTx = await env.sequencerFeeVault.withdraw({ const withdrawTx = await env.sequencerFeeVault.withdraw({
gasPrice: 0, // Need a gasprice of 0 or the balances will include the fee paid during this tx. gasPrice: await gasPriceForL2(env), // Will be zero on HH
}) })
// Wait for the withdrawal to be relayed to L1. // Wait for the withdrawal to be relayed to L1.
await withdrawTx.wait()
await env.relayXDomainMessages(withdrawTx)
await env.waitForXDomainTransaction(withdrawTx, Direction.L2ToL1) await env.waitForXDomainTransaction(withdrawTx, Direction.L2ToL1)
// Balance difference should be equal to old L2 balance. // Balance difference should be equal to old L2 balance.
......
build: build:
DOCKER_BUILDKIT=1 \ DOCKER_BUILDKIT=1 \
docker-compose \
-f docker-compose.yml build builder
DOCKER_BUILDKIT=1 \
docker-compose \ docker-compose \
-f docker-compose.yml build -f docker-compose.yml build
.PHONY: build .PHONY: build
......
version: "3" version: "3"
services: services:
# base service builder
builder:
image: ethereumoptimism/builder:${DOCKER_TAG:-latest}
build:
context: ..
dockerfile: ./ops/docker/Dockerfile.monorepo
# this is a helper service used because there's no official hardhat image # this is a helper service used because there's no official hardhat image
l1_chain: l1_chain:
image: ethereumoptimism/hardhat:${DOCKER_TAG:-latest} image: ethereumoptimism/hardhat:${DOCKER_TAG:-latest}
...@@ -21,10 +14,10 @@ services: ...@@ -21,10 +14,10 @@ services:
deployer: deployer:
depends_on: depends_on:
- l1_chain - l1_chain
image: ethereumoptimism/deployer:${DOCKER_TAG:-latest}
build: build:
context: .. context: ..
dockerfile: ./ops/docker/Dockerfile.deployer dockerfile: ./ops/docker/Dockerfile.packages
target: deployer
entrypoint: ./deployer.sh entrypoint: ./deployer.sh
environment: environment:
FRAUD_PROOF_WINDOW_SECONDS: 0 FRAUD_PROOF_WINDOW_SECONDS: 0
...@@ -56,10 +49,10 @@ services: ...@@ -56,10 +49,10 @@ services:
- l1_chain - l1_chain
- deployer - deployer
- l2geth - l2geth
image: ethereumoptimism/data-transport-layer:${DOCKER_TAG:-latest}
build: build:
context: .. context: ..
dockerfile: ./ops/docker/Dockerfile.data-transport-layer dockerfile: ./ops/docker/Dockerfile.packages
target: data-transport-layer
# override with the dtl script and the env vars required for it # override with the dtl script and the env vars required for it
entrypoint: ./dtl.sh entrypoint: ./dtl.sh
env_file: env_file:
...@@ -81,7 +74,6 @@ services: ...@@ -81,7 +74,6 @@ services:
depends_on: depends_on:
- l1_chain - l1_chain
- deployer - deployer
image: ethereumoptimism/l2geth:${DOCKER_TAG:-latest}
build: build:
context: .. context: ..
dockerfile: ./ops/docker/Dockerfile.geth dockerfile: ./ops/docker/Dockerfile.geth
...@@ -109,10 +101,10 @@ services: ...@@ -109,10 +101,10 @@ services:
- l1_chain - l1_chain
- deployer - deployer
- l2geth - l2geth
image: ethereumoptimism/message-relayer:${DOCKER_TAG:-latest}
build: build:
context: .. context: ..
dockerfile: ./ops/docker/Dockerfile.message-relayer dockerfile: ./ops/docker/Dockerfile.packages
target: relayer
entrypoint: ./relayer.sh entrypoint: ./relayer.sh
environment: environment:
L1_NODE_WEB3_URL: http://l1_chain:8545 L1_NODE_WEB3_URL: http://l1_chain:8545
...@@ -129,10 +121,10 @@ services: ...@@ -129,10 +121,10 @@ services:
- l1_chain - l1_chain
- deployer - deployer
- l2geth - l2geth
image: ethereumoptimism/batch-submitter:${DOCKER_TAG:-latest}
build: build:
context: .. context: ..
dockerfile: ./ops/docker/Dockerfile.batch-submitter dockerfile: ./ops/docker/Dockerfile.packages
target: batch-submitter
entrypoint: ./batches.sh entrypoint: ./batches.sh
env_file: env_file:
- ./envs/batches.env - ./envs/batches.env
...@@ -147,7 +139,6 @@ services: ...@@ -147,7 +139,6 @@ services:
- l1_chain - l1_chain
- deployer - deployer
- dtl - dtl
image: ethereumoptimism/l2geth:${DOCKER_TAG:-latest}
deploy: deploy:
replicas: 0 replicas: 0
build: build:
...@@ -171,7 +162,6 @@ services: ...@@ -171,7 +162,6 @@ services:
replica: replica:
depends_on: depends_on:
- dtl - dtl
image: ethereumoptimism/l2geth:${DOCKER_TAG:-latest}
deploy: deploy:
replicas: 0 replicas: 0
build: build:
...@@ -193,12 +183,12 @@ services: ...@@ -193,12 +183,12 @@ services:
- ${L2GETH_WS_PORT:-8550}:8546 - ${L2GETH_WS_PORT:-8550}:8546
integration_tests: integration_tests:
image: ethereumoptimism/integration-tests:${DOCKER_TAG:-latest}
deploy: deploy:
replicas: 0 replicas: 0
build: build:
context: .. context: ..
dockerfile: ./ops/docker/Dockerfile.integration-tests dockerfile: ./ops/docker/Dockerfile.packages
target: integration-tests
entrypoint: ./integration-tests.sh entrypoint: ./integration-tests.sh
environment: environment:
L1_URL: http://l1_chain:8545 L1_URL: http://l1_chain:8545
...@@ -208,7 +198,6 @@ services: ...@@ -208,7 +198,6 @@ services:
NO_NETWORK: 1 NO_NETWORK: 1
gas_oracle: gas_oracle:
image: ethereumoptimism/gas-oracle:${DOCKER_TAG:-latest}
deploy: deploy:
replicas: 0 replicas: 0
build: build:
......
...@@ -25,4 +25,4 @@ WORKDIR /opt/optimism/integration-tests ...@@ -25,4 +25,4 @@ WORKDIR /opt/optimism/integration-tests
COPY --from=builder /optimism/integration-tests ./ COPY --from=builder /optimism/integration-tests ./
COPY ./ops/scripts/integration-tests.sh ./ COPY ./ops/scripts/integration-tests.sh ./
ENTRYPOINT yarn test:integration CMD ["yarn", "test:integration"]
# This Dockerfile builds all the dependencies needed by the monorepo, and should
# be used to build any of the follow-on services
#
# ### BASE: Install deps
# We do not use Alpine because there's a regression causing it to be very slow
# when used with typescript/hardhat: https://github.com/nomiclabs/hardhat/issues/1219
FROM node:14.18.1-buster-slim as base
RUN apt-get update -y && apt-get install -y git curl jq python3
# copy over the needed configs to run the dep installation
# note: this approach can be a bit unhandy to maintain, but it allows
# us to cache the installation steps
WORKDIR /optimism
COPY *.json yarn.lock ./
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/data-transport-layer/package.json ./packages/data-transport-layer/package.json
COPY packages/batch-submitter/package.json ./packages/batch-submitter/package.json
COPY packages/message-relayer/package.json ./packages/message-relayer/package.json
COPY packages/replica-healthcheck/package.json ./packages/replica-healthcheck/package.json
COPY packages/regenesis-surgery/package.json ./packages/regenesis-surgery/package.json
COPY integration-tests/package.json ./integration-tests/package.json
RUN yarn install --frozen-lockfile
COPY ./packages ./packages
COPY ./integration-tests ./integration-tests
# build it!
RUN yarn build
FROM base as deployer
WORKDIR /optimism/packages/contracts
COPY ./ops/scripts/deployer.sh .
CMD ["yarn", "run", "deploy"]
FROM base as batch-submitter
WORKDIR /optimism/packages/batch-submitter
COPY ./ops/scripts/batches.sh .
CMD ["npm", "run", "start"]
FROM base as data-transport-layer
WORKDIR /optimism/packages/data-transport-layer
COPY ./ops/scripts/dtl.sh .
CMD ["node", "dist/src/services/run.js"]
FROM base as integration-tests
WORKDIR /optimism/integration-tests
COPY ./ops/scripts/integration-tests.sh ./
CMD ["yarn", "test:integration"]
FROM base as relayer
WORKDIR /opt/optimism/packages/message-relayer
COPY ./ops/scripts/relayer.sh .
ENTRYPOINT ["npm", "run", "start"]
\ No newline at end of file
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