|
1 | 1 | # Base OS |
2 | | -FROM debian |
| 2 | +FROM ubuntu:24.04 |
3 | 3 |
|
4 | | -# Install requirements |
| 4 | +# Update package list & install some basic tools we'll need. |
5 | 5 | 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 make g++ wget git |
8 | 7 |
|
9 | | -# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps. |
10 | | -RUN python3 -m venv test_env |
11 | | - |
12 | | -# Activate venv. |
13 | | -ENV PATH="test_env/bin:$PATH" |
| 8 | +# Ubuntu 24's version of CMake is 3.28. We need a newer version. |
| 9 | +RUN apt-get remove --purge --auto-remove cmake |
| 10 | +RUN wget -q 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 |
14 | 12 |
|
| 13 | +# Copy qsim files from the outside-Docker location to an inside-Docker location. |
15 | 14 | COPY ./ /qsim/ |
16 | | -RUN pip3 install /qsim/ |
17 | 15 |
|
18 | | -# Run test in a non-qsim directory |
| 16 | +# Switch to that location. |
| 17 | +WORKDIR /qsim/ |
| 18 | + |
| 19 | +# Create venv to avoid collision between system packages and what we install. |
| 20 | +RUN python3 -m venv --upgrade-deps /qsim/test_env |
| 21 | + |
| 22 | +# Activate the venv. |
| 23 | +ENV PATH="/qsim/test_env/bin:$PATH" |
| 24 | + |
| 25 | +# Install qsim from sources. |
| 26 | +# Note: use pip3 here, not python3 -m pip. We need to make sure to get the pip |
| 27 | +# installed inside the venv, because that one has the correct sys.path. |
| 28 | +RUN pip3 install -v /qsim/ |
| 29 | + |
| 30 | +# Copy the tests to a non-qsim directory. |
19 | 31 | COPY ./qsimcirq_tests/ /test-install/ |
20 | 32 |
|
| 33 | +# Run the tests from that location. |
21 | 34 | WORKDIR /test-install/ |
22 | | - |
23 | 35 | ENTRYPOINT python3 -m pytest ./ |
0 commit comments