forked from AztecProtocol/aztec-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.fast
127 lines (105 loc) · 4.33 KB
/
Dockerfile.fast
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
126
127
# Builds aztec image quickly, bootstrapping from S3 cache.
# TODO: Implement fallback to a normal build when cache is unavailable.
# Currently optimized for 'yarn-project' oriented workflow.
# If other components are iterated on, this will still work if a PR pushes to cache, or earthly-local is tweaked to push to cache and the component built.
# Use an ARG to define the architecture, defaulting to amd64
ARG ARCH=amd64
# Set the base image based on the architecture
FROM aztecprotocol/build:1.0-${ARCH}
# Set the working directory
WORKDIR /usr/src
# Initialize git repository for computing content hash
RUN git init -b master \
&& git config --global gc.auto 0 \
&& git add . \
&& git config user.name 'AztecBot' \
&& git config user.email '[email protected]'
# ---------- EXTRACT BUILD-SYSTEM ----------
COPY build-system build-system
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# ---------- BUILD BARRETENBERG ----------
COPY barretenberg barretenberg
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# Bootstrap cache for barretenberg/cpp
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
bash -c 'cd barretenberg \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh' \
&& echo "barretenberg: Success"
# ---------- BUILD NOIR ----------
ADD noir noir
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# Bootstrap cache for Noir
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
bash -c 'cd noir \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh' \
&& echo "noir: Success"
# ---------- BUILD L1 CONTRACTS ----------
ADD l1-contracts l1-contracts
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# Bootstrap cache for L1 Contracts
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
bash -c 'cd l1-contracts \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh' \
&& echo "l1-contracts: Success"
# ---------- BUILD AVM TRANSPILER ----------
ADD avm-transpiler avm-transpiler
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# Bootstrap cache for AVM Transpiler
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
bash -c 'cd avm-transpiler \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh' \
&& echo "avm-transpiler: Success"
# ---------- BUILD NOIR PROJECTS ----------
ADD noir-projects noir-projects
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# Bootstrap cache for Noir Projects
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
bash -c 'cd noir-projects \
&& AWS_ACCESS_KEY_ID=$(cat /run/secrets/aws_access_key_id) \
AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) \
./bootstrap_cache.sh' \
&& echo "noir-projects: Success"
# ---------- BUILD YARN PROJECT ----------
ADD yarn-project yarn-project
RUN git add . \
&& git commit -m "Update git metadata" >/dev/null
# Build yarn-project directly (no cache script)
RUN cd yarn-project \
&& ./bootstrap.sh fast-only \
&& echo "yarn-project: Success"
# ---------- SETUP ENVIRONMENT VARIABLES ----------
ENV BB_WORKING_DIRECTORY=/usr/src/bb
ENV BB_BINARY_PATH=/usr/src/barretenberg/cpp/build/bin/bb
ENV ACVM_WORKING_DIRECTORY=/usr/src/acvm
ENV ACVM_BINARY_PATH=/usr/src/noir/noir-repo/target/release/acvm
ENV PORT=8080
# Create necessary directories
RUN mkdir -p $BB_WORKING_DIRECTORY \
$ACVM_WORKING_DIRECTORY \
/usr/src/yarn-project/world-state/build
# Set the entrypoint
ENTRYPOINT ["node", "--no-warnings", "/usr/src/yarn-project/aztec/dest/bin/index.js"]
# Healthcheck configuration
HEALTHCHECK --interval=10s --timeout=10s --retries=6 --start-period=120s \
CMD curl -fsS http://127.0.0.1:$PORT/status
# Expose port 8080
EXPOSE 8080