|
10 | 10 | # argument MUST be given by the build script, otherwise build will fail.
|
11 | 11 | ARG BASE_IMAGE=
|
12 | 12 |
|
| 13 | +# We support prod and dev images |
| 14 | +ARG BUILD_TYPE= |
13 | 15 |
|
14 |
| -FROM $BASE_IMAGE |
| 16 | + |
| 17 | +FROM $BASE_IMAGE as output_prod |
15 | 18 |
|
16 | 19 | USER root:root
|
17 | 20 |
|
@@ -112,12 +115,6 @@ RUN systemctl disable \
|
112 | 115 | # ruleset.
|
113 | 116 | RUN ln -sf /run/ic-node/nftables-ruleset/nftables.conf /etc/nftables.conf
|
114 | 117 |
|
115 |
| -ARG ROOT_PASSWORD= |
116 |
| -RUN \ |
117 |
| - if [ "${ROOT_PASSWORD}" != "" ]; then \ |
118 |
| - echo "root:$(openssl passwd -6 -salt jE8zzDEHeRg/DuGq ${ROOT_PASSWORD})" | chpasswd -e ; \ |
119 |
| - fi |
120 |
| - |
121 | 118 | # Clear additional files that may lead to indeterministic build.
|
122 | 119 | RUN rm -rf \
|
123 | 120 | /usr/local/share/qemu/edk2-arm-code.fd \
|
@@ -198,3 +195,28 @@ RUN find /opt -type d -exec chmod 0755 {} \+ && \
|
198 | 195 | find /opt -type f -exec chmod 0644 {} \+ && \
|
199 | 196 | chmod 0755 /opt/ic/bin/* && \
|
200 | 197 | chmod 0644 /opt/ic/share/*
|
| 198 | + |
| 199 | +# ------ DEV VARIANT --------------------------------------------- |
| 200 | + |
| 201 | +# The following steps apply conditionally to the dev image ONLY |
| 202 | +# https://www.docker.com/blog/advanced-dockerfiles-faster-builds-and-smaller-images-using-buildkit-and-multistage-builds/#4374 |
| 203 | +FROM output_prod as output_dev |
| 204 | + |
| 205 | +USER root:root |
| 206 | + |
| 207 | +# Set a root password if specified |
| 208 | +ARG ROOT_PASSWORD= |
| 209 | +RUN \ |
| 210 | + if [ "${ROOT_PASSWORD}" != "" ]; then \ |
| 211 | + echo "root:$(openssl passwd -6 -salt jE8zzDEHeRg/DuGq ${ROOT_PASSWORD})" | chpasswd -e ; \ |
| 212 | + fi |
| 213 | + |
| 214 | +# Include the dev root CA cert |
| 215 | +COPY dev-certs/canister_http_test_ca.cert /usr/local/share/ca-certificates/dev-root-ca.crt |
| 216 | +RUN chmod 0644 /usr/local/share/ca-certificates/dev-root-ca.crt |
| 217 | +RUN update-ca-certificates |
| 218 | + |
| 219 | + |
| 220 | +FROM output_${BUILD_TYPE} |
| 221 | + |
| 222 | +USER root:root |
0 commit comments