@@ -36,7 +36,6 @@ RUN adduser -D -s /bin/bash bootcamp
3636ENV SCALA_VERSION=2.12.10
3737ENV ALMOND_VERSION=0.9.1
3838ENV COURSIER_VERSION=2.1.24
39- ENV COURSIER_CACHE=/coursier_cache
4039ENV JUPYTER_CONFIG_DIR=/jupyter/config
4140ENV JUPYTER_DATA_DIR=/jupyter/data
4241
@@ -47,7 +46,9 @@ RUN mkdir -p $JUPYTER_CONFIG_DIR/custom && \
4746 mkdir -p $JUPYTER_CONFIG_DIR/lab/user-settings/@jupyterlab/apputils-extension && \
4847 cp source/custom.js $JUPYTER_CONFIG_DIR/custom/ && \
4948 cp source/jupyter_server_config.py $JUPYTER_CONFIG_DIR/ && \
50- cp source/overrides.json $JUPYTER_CONFIG_DIR/lab/user-settings/@jupyterlab/apputils-extension/notification.jupyterlab-settings
49+ cp source/overrides.json $JUPYTER_CONFIG_DIR/lab/user-settings/@jupyterlab/apputils-extension/notification.jupyterlab-settings && \
50+ cp source/jupyter-wrapper.sh /usr/local/bin/jupyter-wrapper && \
51+ chmod +x /usr/local/bin/jupyter-wrapper
5152
5253# Second stage - download Scala requirements and the Scala kernel
5354FROM base AS intermediate-builder
8687 --default=true \
8788 -o almond && \
8889 ./almond --install --global && \
89- # Preload Chisel dependencies to avoid first-run delay before removing coursier
90+ # Preload Chisel dependencies - coursier fetch downloads to its default cache
91+ # which gets picked up by Ammonite at runtime
92+ ./coursier fetch \
93+ --intransitive \
94+ edu.berkeley.cs:chisel3-plugin_2.12.10:3.6.1 \
95+ && \
9096 ./coursier fetch \
9197 edu.berkeley.cs:chisel3_2.12:3.6.1 \
9298 edu.berkeley.cs:chisel-iotesters_2.12:2.5.6 \
@@ -95,20 +101,23 @@ RUN \
95101 edu.berkeley.cs:rocket-dsptools_2.12:1.2.0 \
96102 org.scalanlp:breeze_2.12:1.0 \
97103 org.scalatest:scalatest_2.12:3.2.2 \
98- --cache /coursier_cache && \
99- rm -rf almond coursier /root/.cache/coursier
104+ && \
105+ rm -rf almond coursier
100106
101107# Last stage
102108FROM base AS final
103109
110+ # Set COURSIER_CACHE environment variable so Ammonite uses our preloaded cache
111+ ENV COURSIER_CACHE=/coursier_cache
112+
104113# copy the Scala requirements and kernel into the image
105114COPY --from=intermediate-builder --chown=bootcamp:bootcamp /coursier_cache/ /coursier_cache/
106115COPY --from=intermediate-builder --chown=bootcamp:bootcamp /usr/local/share/jupyter/kernels/scala/ /usr/local/share/jupyter/kernels/scala/
107116
108- RUN chown -R bootcamp:bootcamp /chisel-bootcamp /jupyter
117+ RUN chown -R bootcamp:bootcamp /chisel-bootcamp /jupyter /coursier_cache
109118
110119USER bootcamp
111120WORKDIR /chisel-bootcamp
112121
113122EXPOSE 8888
114- CMD jupyter lab --no-browser --ip 0.0.0.0 --port 8888
123+ CMD [ " jupyter" , " lab" , " --no-browser" , " --ip" , " 0.0.0.0" , " --port" , " 8888" ]
0 commit comments