2021-12-12 02:57:20 -08:00
|
|
|
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
|
2023-05-19 17:34:06 -07:00
|
|
|
FROM const-gen AS const-export
|
2023-06-13 14:01:43 -07:00
|
|
|
FROM node:19.6.1-slim@sha256:a1ba21bf0c92931d02a8416f0a54daad66cb36a85d2b73af9d73b044f5f57cfc
|
2020-08-15 16:38:10 -07:00
|
|
|
|
2020-08-16 02:25:37 -07:00
|
|
|
# npm wants to clone random Git repositories - lovely.
|
2023-06-13 14:01:43 -07:00
|
|
|
# RUN apk add git python make build-base
|
|
|
|
# RUN apk update && apk add bash
|
|
|
|
RUN apt-get update && apt-get -y install \
|
2024-03-12 13:48:32 -07:00
|
|
|
git python make curl netcat vim
|
2023-06-13 14:01:43 -07:00
|
|
|
|
|
|
|
RUN npm i typescript -g
|
|
|
|
RUN curl -L https://foundry.paradigm.xyz | bash
|
|
|
|
RUN $HOME/.foundry/bin/foundryup
|
|
|
|
RUN ls $HOME/.foundry/bin
|
2020-08-16 02:25:37 -07:00
|
|
|
|
2020-08-15 16:38:10 -07:00
|
|
|
# Run as user, otherwise, npx explodes.
|
2023-06-13 14:01:43 -07:00
|
|
|
RUN mv /root/.foundry/bin/forge /bin/forge
|
2020-08-15 16:38:10 -07:00
|
|
|
USER 1000
|
2023-06-13 14:01:43 -07:00
|
|
|
|
|
|
|
|
2020-08-15 16:38:10 -07:00
|
|
|
RUN mkdir -p /home/node/app
|
|
|
|
RUN mkdir -p /home/node/.npm
|
2023-06-13 14:01:43 -07:00
|
|
|
|
2020-08-15 16:38:10 -07:00
|
|
|
WORKDIR /home/node/app
|
|
|
|
|
2022-03-30 21:32:27 -07:00
|
|
|
# Fix git ssh error
|
|
|
|
RUN git config --global url."https://".insteadOf ssh://
|
|
|
|
|
2023-06-13 14:01:43 -07:00
|
|
|
WORKDIR /home/node/app
|
|
|
|
|
2020-08-17 02:17:49 -07:00
|
|
|
# Only invalidate the npm install step if package.json changed
|
2022-07-05 13:40:42 -07:00
|
|
|
COPY --chown=node:node package.json .
|
|
|
|
COPY --chown=node:node package-lock.json .
|
2023-05-19 17:34:06 -07:00
|
|
|
COPY --from=const-export --chown=node:node .env.0x .env
|
2020-08-15 16:38:10 -07:00
|
|
|
|
2023-06-13 14:01:43 -07:00
|
|
|
|
2020-08-15 16:38:10 -07:00
|
|
|
# We want to cache node_modules *and* incorporate it into the final image.
|
|
|
|
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
|
|
|
|
--mount=type=cache,uid=1000,gid=1000,target=node_modules \
|
2023-06-13 14:01:43 -07:00
|
|
|
npm ci && \
|
|
|
|
cp -R node_modules node_modules_cache
|
|
|
|
|
2020-08-15 16:38:10 -07:00
|
|
|
|
|
|
|
# Amusingly, Debian's coreutils version has a bug where mv believes that
|
|
|
|
# the target is on a different fs and does a full recursive copy for what
|
|
|
|
# could be a renameat syscall. Alpine does not have this bug.
|
2022-02-23 10:12:16 -08:00
|
|
|
RUN rm -rf node_modules && mv node_modules_cache node_modules
|
2020-08-17 02:17:49 -07:00
|
|
|
|
2023-06-13 14:01:43 -07:00
|
|
|
ARG dev
|
|
|
|
ENV DEV=$dev
|
|
|
|
|
2022-07-05 13:40:42 -07:00
|
|
|
COPY --chown=node:node . .
|
2023-06-13 14:01:43 -07:00
|
|
|
RUN make build
|
|
|
|
|
|
|
|
ARG num_guardians
|
|
|
|
ENV NUM_GUARDIANS=$num_guardians
|