Skip to content

Commit a73c303

Browse files
committed
Overhaul Dockerfiles
The main change is to install CMake 3.31.7 rather than to use the version installed by `apt install cmake`, because the latter version is too old (3.28). Some additional changes were needed to make things work on local Linux, Mac, and GitHub runners.
1 parent 937221c commit a73c303

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
# Base OS
2-
FROM debian
2+
FROM ubuntu:24.04
33

4-
# Install baseline
5-
RUN apt-get update
6-
RUN apt-get install -y g++ make wget
4+
# Update package list & install some basic tools we'll need.
5+
RUN apt update
6+
RUN apt install -y make g++ wget git
7+
8+
# The default version of CMake is 3.28. Get a newer version from Kitware.
9+
RUN apt remove --purge --auto-remove cmake
10+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-linux-x86_64.sh
11+
RUN sh cmake-3.31.7-linux-x86_64.sh --prefix=/usr/local --skip-license
712

813
# Copy relevant files for simulation
914
COPY ./Makefile /qsim/Makefile
1015
COPY ./apps/ /qsim/apps/
1116
COPY ./circuits/ /qsim/circuits/
1217
COPY ./lib/ /qsim/lib/
1318

14-
WORKDIR /qsim/
19+
# Copy Python requirements file for other images based on this one.
20+
COPY ./requirements.txt /qsim/requirements.txt
1521

16-
# Compile qsim
22+
# Compile qsim.
23+
WORKDIR /qsim/
1724
RUN make qsim
1825

1926
ENTRYPOINT ["/qsim/apps/qsim_base.x"]

install/tests/Dockerfile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
# Base OS
2-
FROM debian
2+
FROM ubuntu:24.04
33

4-
# Install requirements
4+
# Update package list & install some basic tools we'll need.
55
RUN apt-get update
6-
RUN apt-get install -y python3-dev python3-pip python3-venv
7-
RUN apt-get install -y cmake git
6+
RUN apt-get install -y python3-dev python3-pip python3-venv wget git
87

9-
# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps.
8+
# The default version of CMake is 3.28. Get a newer version from Kitware.
9+
RUN apt remove --purge --auto-remove cmake
10+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-linux-x86_64.sh
11+
RUN sh cmake-3.31.7-linux-x86_64.sh --prefix=/usr/local --skip-license
12+
13+
# Copy qsim files from the outside-Docker location to an inside-Docker location.
14+
COPY ./ /qsim/
15+
WORKDIR /qsim/
16+
17+
# Use venv to avoid collision between system packages (e.g., NumPy) and our deps
1018
RUN python3 -m venv test_env
1119

1220
# Activate venv.
1321
ENV PATH="test_env/bin:$PATH"
1422

15-
COPY ./ /qsim/
16-
RUN pip3 install /qsim/
23+
# Install dev requirements
24+
RUN pip3 install -r dev-requirements.txt
25+
26+
# Install qsim from the local sources
27+
RUN pip3 install .
1728

18-
# Run test in a non-qsim directory
29+
# Run tests in a non-qsim directory
1930
COPY ./qsimcirq_tests/ /test-install/
2031

2132
WORKDIR /test-install/

0 commit comments

Comments
 (0)