-
Notifications
You must be signed in to change notification settings - Fork 284
/
Dockerfile.fast
143 lines (120 loc) · 5.06 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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.tar.gz .
RUN tar -xzf build-system.tar.gz \
&& rm build-system.tar.gz && git add . \
&& git commit -m "Update git metadata" >/dev/null
# ---------- BUILD BARRETENBERG ----------
COPY barretenberg.tar.gz .
RUN tar -xzf barretenberg.tar.gz \
&& rm barretenberg.tar.gz && 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 \
cd barretenberg/cpp \
&& 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/cpp: Success"
# Bootstrap cache for barretenberg/ts
RUN --mount=type=secret,id=aws_access_key_id \
--mount=type=secret,id=aws_secret_access_key \
cd barretenberg/ts \
&& 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/ts: Success"
# ---------- BUILD NOIR ----------
COPY noir.tar.gz .
RUN tar -xzf noir.tar.gz \
&& rm noir.tar.gz && 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 \
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 ----------
COPY l1-contracts.tar.gz .
RUN tar -xzf l1-contracts.tar.gz \
&& rm l1-contracts.tar.gz && 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 \
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 ----------
COPY avm-transpiler.tar.gz .
RUN tar -xzf avm-transpiler.tar.gz \
&& rm avm-transpiler.tar.gz && 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 \
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 ----------
COPY noir-projects.tar.gz .
RUN tar -xzf noir-projects.tar.gz \
&& rm noir-projects.tar.gz && 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 \
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 ----------
COPY yarn-project.tar.gz .
RUN tar -xzf yarn-project.tar.gz \
&& rm yarn-project.tar.gz && 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