Repository navigation
Expand file tree
/
Copy pathDockerfile.packages
More file actions
125 lines (101 loc) · 3.63 KB
/
Copy pathDockerfile.packages
File metadata and controls
125 lines (101 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# This Dockerfile builds all the dependencies needed by the monorepo, and should
# be used to build any of the follow-on services
#
# Stage 0 (named `manifests`) collects
# dependency manifest files (`package.json` and `pnpm-lock.yaml`) 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 pnpm-lock.yaml pnpm-workspace.yaml .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/ && \
# pnpm-lock.yaml
cp pnpm-lock.yaml ../manifests/ && \
# pnpm-workspace.yaml
cp pnpm-workspace.yaml ../manifests/ && \
# .nvmrc
cp .nvmrc ../manifests/
FROM us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest as foundry
# bullseye-slim is debian based
# we use it rather than alpine because it's not much
# bigger and alpine is often missing packages for node applications
# alpine is not officially supported by node.js
FROM node:20.8.1-bullseye-slim as base
# Base: install deps
RUN apt-get update && apt-get install -y \
curl \
jq \
python3 \
ca-certificates \
git \
g++ \
make \
gcc \
musl-dev \
bash \
# the following 4 deps are needed for node-hid
# which is a deep sub dependency of ethers to install
# correctly
pkg-config \
libusb-1.0-0-dev \
libudev-dev \
--no-install-recommends
COPY /ops/docker/oplabs.crt /usr/local/share/ca-certificates/oplabs.crt
RUN chmod 644 /usr/local/share/ca-certificates/oplabs.crt \
&& update-ca-certificates
RUN npm install pnpm --global
COPY --from=foundry /usr/local/bin/forge /usr/local/bin/forge
COPY --from=foundry /usr/local/bin/cast /usr/local/bin/cast
WORKDIR /opt/optimism
# Copy manifest files into the image in
# preparation for `pnpm install`.
COPY --from=manifests /tmp/manifests ./
COPY *.json ./
RUN pnpm install:ci
COPY ./packages ./packages
COPY .git/ ./.git
COPY .gitmodules ./.gitmodules
RUN git submodule update --init --recursive
COPY --from=1password/op:2 /usr/local/bin/op /usr/local/bin/op
RUN pnpm build
ENTRYPOINT ["pnpm", "run"]
FROM base as chain-mon
WORKDIR /opt/optimism/packages/chain-mon
# TODO keeping the rest of these here for now because they are being used
# but we should really delete them we only need one image
FROM base as balance-mon
WORKDIR /opt/optimism/packages/chain-mon
CMD ["start:balance-mon"]
FROM base as drippie-mon
WORKDIR /opt/optimism/packages/chain-mon
CMD ["start:drippie-mon"]
from base as fault-mon
WORKDIR /opt/optimism/packages/chain-mon
CMD ["start:fault-mon"]
from base as multisig-mon
WORKDIR /opt/optimism/packages/multisig-mon
CMD ["start:multisig-mon"]
FROM base as replica-mon
WORKDIR /opt/optimism/packages/chain-mon
CMD ["start:replica-mon"]
FROM base as wallet-mon
WORKDIR /opt/optimism/packages/chain-mon
CMD ["start:wallet-mon"]
FROM base as wd-mon
WORKDIR /opt/optimism/packages/chain-mon
CMD ["start:wd-mon"]
FROM base as contracts-bedrock
WORKDIR /opt/optimism/packages/contracts-bedrock
CMD ["deploy"]