-
Notifications
You must be signed in to change notification settings - Fork 613
Expand file tree
/
Copy pathDockerfile.prod
More file actions
63 lines (60 loc) · 2.95 KB
/
Copy pathDockerfile.prod
File metadata and controls
63 lines (60 loc) · 2.95 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
# This productionifies the workspace, removing all developer dependencies and producing a final slim image from which
# we then generate downstream multiarch containers to execute the specific projects.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project AS yarn-project
# Need new arch specific image.
FROM node:18.19.0 AS builder
RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* && apt-get clean
COPY --from=yarn-project /usr/src /usr/src
WORKDIR /usr/src/yarn-project
ARG COMMIT_TAG=""
# TODO: Use release-please to update package.json directly, and remove this!
RUN ./scripts/version_packages.sh
# Productionify. See comment in yarn-project-base/Dockerfile.
RUN yarn workspaces focus @aztec/cli @aztec/aztec @aztec/aztec-faucet @aztec/aztec.js --production && \
yarn cache clean && \
rm -rf /usr/src/barretenberg/ts/src && \
# TODO: Fix by extracting noir code out of yarn-project.
# This was just a "rm -rf ./**/src".
# Due to the mess of us needing to find noir code in noir-protocol-circuits/src/crates we have to do this...
find . -maxdepth 2 -name src -type d | grep -v "./noir-protocol-circuits" | xargs rm -rf
# We no longer need nargo.
RUN rm -rf /usr/src/noir/target
# Create fresh minimal size image.
# Installs our specific version of node, stripping out the unnecessary.
# We could probably just apt install nodejs, but it's both a different version, and seemingly a bit slower.
# We could also use distroless, to get us about 20mb off, but meh. It's actually useful to shell into containers.
#FROM gcr.io/distroless/nodejs18-debian12
FROM ubuntu:lunar
# RUN apt update && apt install -y nodejs && rm -rf /var/lib/apt/lists/* && apt-get clean
RUN apt update && apt install -y curl && rm -rf /var/lib/apt/lists/* && apt-get clean
ENV NODE_VERSION=18.19.0
RUN ARCH= && \
dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
arm64) ARCH='arm64';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.gz" && \
tar zxf "node-v$NODE_VERSION-linux-$ARCH.tar.gz" -C /usr --strip-components=1 --no-same-owner \
--exclude "*/share/*" \
--exclude "*/bin/corepack" \
--exclude "*/bin/npx" \
--exclude "*/bin/npm" \
--exclude "*/corepack/*" \
--exclude "*/npm/man/*" \
--exclude "*/npm/docs/*" \
--exclude "*/include/*" && \
rm "node-v$NODE_VERSION-linux-$ARCH.tar.gz" && \
node --version
# Yarn is used for unboxing.
ENV YARN_VERSION=1.22.19
RUN curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" && \
mkdir -p /opt && \
tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ && \
ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn && \
ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg && \
rm yarn-v$YARN_VERSION.tar.gz && \
yarn --version
COPY --from=builder /usr/src /usr/src
ENTRYPOINT ["/usr/bin/node"]