Skip to content

Commit c1594b9

Browse files
authored
Make jupyter/Dockerfile build again (#945)
`jupyter/Dockerfile` failed to build for me due to changes in more recent versions of Jupyter and Ubuntu. Downgrading some packages like `notebook` and using a different combination of commands for the notebook extensions resolved the failures. In addition, this PR also addresses lint errors reported by `hadolint`.
1 parent aca4ca9 commit c1594b9

3 files changed

Lines changed: 31 additions & 16 deletions

File tree

jupyter/Dockerfile

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,37 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Base OS
16-
FROM ubuntu:24.04
15+
FROM ubuntu:24.04 AS qsimcirq
16+
17+
# hadolint ignore=DL3002
1718
USER root
1819

19-
# Install baseline
20-
RUN apt-get -y update && \
21-
apt-get install -y python3-dev python3-pip git && \
22-
python3 -m pip install --upgrade pip && \
23-
python3 -m pip install cirq && \
24-
python3 -m pip install cirq[contrib] && \
25-
python3 -m pip install qsimcirq && \
26-
python3 -m pip install jupyterlab && \
27-
python3 -m pip install jupyter_http_over_ws && \
28-
jupyter serverextension enable --py jupyter_http_over_ws && \
29-
cd / && \
30-
git clone https://github.com/quantumlib/qsim.git
31-
32-
RUN jupyter serverextension enable --py jupyter_http_over_ws
20+
# hadolint ignore=DL3008
21+
RUN apt-get update && \
22+
apt-get install -y --no-install-recommends python3-pip python3-dev git \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
# Newer Ubuntus adopted PEP 668, which blocks pip from installing into system
26+
# locations, but Docker is already an isolated environment, so we don't mind.
27+
ENV PIP_BREAK_SYSTEM_PACKAGES=1
28+
29+
RUN python3 -m pip install --no-cache-dir \
30+
cirq~=1.0 \
31+
cirq[contrib]~=1.0 \
32+
qsimcirq~=0.1 \
33+
notebook==6.4.8 \
34+
jupyterlab==4.4.10 \
35+
jupyter-contrib-nbextensions==0.7.0 \
36+
jupyter-nbextensions-configurator==0.6.4 \
37+
jupyter-http-over-ws==0.0.8
38+
39+
WORKDIR /
40+
41+
RUN git clone https://github.com/quantumlib/qsim.git
42+
43+
RUN jupyter contrib nbextension install --user && \
44+
jupyter nbextension enable varInspector/main && \
45+
jupyter serverextension enable --py jupyter_http_over_ws
3346

3447
CMD ["jupyter-notebook", "--port=8888", "--no-browser",\
3548
"--ip=0.0.0.0", "--allow-root", \

pybind_interface/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
# Base OS
16+
# hadolint ignore=DL3006
1617
FROM qsim-base AS qsim-py-tests
1718

1819
# Copy relevant files

tests/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
# Base OS
16+
# hadolint ignore=DL3006
1617
FROM qsim-base AS qsim-cxx-tests
1718

1819
# Copy relevant files

0 commit comments

Comments
 (0)