Skip to content
28 changes: 22 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
# Base OS
FROM debian
FROM ubuntu:24.04

# Install baseline
# Update package list & install some basic tools we'll need.
RUN apt-get update
RUN apt-get install -y g++ make wget
RUN apt-get install -y python3-dev python3-pip python3-venv make g++ wget git

# Copy relevant files for simulation
# Ubuntu 24's version of CMake is 3.28. We need a newer version.
RUN apt-get remove --purge --auto-remove cmake
RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-linux-x86_64.sh
RUN sh cmake-3.31.7-linux-x86_64.sh --prefix=/usr/local --skip-license

# Copy relevant files for simulation.
COPY ./Makefile /qsim/Makefile
COPY ./apps/ /qsim/apps/
COPY ./circuits/ /qsim/circuits/
COPY ./lib/ /qsim/lib/
COPY ./requirements.txt /qsim/requirements.txt
COPY ./dev-requirements.txt /qsim/dev-requirements.txt

WORKDIR /qsim/
# Create venv to avoid collision between system packages and what we install.
RUN python3 -m venv --upgrade-deps test_env

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

# Compile qsim
# Install qsim requirements.
RUN python3 -m pip install -r /qsim/requirements.txt
RUN python3 -m pip install -r /qsim/dev-requirements.txt

# Compile qsim.
WORKDIR /qsim/
RUN make qsim

ENTRYPOINT ["/qsim/apps/qsim_base.x"]
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
qsim:
image: qsim
Expand All @@ -21,4 +20,4 @@ services:
context: ./
dockerfile: pybind_interface/Dockerfile
depends_on:
- qsim
- qsim
36 changes: 24 additions & 12 deletions install/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# Base OS
FROM debian
FROM ubuntu:24.04

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

# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps.
RUN python3 -m venv test_env

# Activate venv.
ENV PATH="test_env/bin:$PATH"
# Ubuntu 24's version of CMake is 3.28. We need a newer version.
RUN apt-get remove --purge --auto-remove cmake
RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-linux-x86_64.sh
RUN sh cmake-3.31.7-linux-x86_64.sh --prefix=/usr/local --skip-license

# Copy qsim files from the outside-Docker location to an inside-Docker location.
COPY ./ /qsim/
RUN pip3 install /qsim/

# Run test in a non-qsim directory
# Switch to that location.
WORKDIR /qsim/

# Create venv to avoid collision between system packages and what we install.
RUN python3 -m venv --upgrade-deps /qsim/test_env

# Activate the venv.
ENV PATH="/qsim/test_env/bin:$PATH"

# Install qsim from sources.
# Note: use pip3 here, not python3 -m pip. We need to make sure to get the pip
# installed inside the venv, because that one has the correct sys.path.
RUN pip3 install -v /qsim/

# Copy the tests to a non-qsim directory.
COPY ./qsimcirq_tests/ /test-install/

# Run the tests from that location.
WORKDIR /test-install/

ENTRYPOINT python3 -m pytest ./
3 changes: 1 addition & 2 deletions install/tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
# Verifies that installing from the `qsimcirq` PyPI package works correctly.
# To ensure that users do not need to clone the qsim repository in order to
Expand All @@ -8,4 +7,4 @@ services:
container_name: qsim-install
build:
context: ../../
dockerfile: ./install/tests/Dockerfile
dockerfile: ./install/tests/Dockerfile
2 changes: 1 addition & 1 deletion jupyter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base OS
FROM debian:bullseye
FROM ubuntu:24.04
USER root

# Install baseline
Expand Down
15 changes: 0 additions & 15 deletions pybind_interface/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# Base OS
FROM qsim

# Install additional requirements
RUN apt-get install -y python3-dev python3-pybind11 python3-pip python3-venv

# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps.
RUN python3 -m venv test_env

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

# break-system-packages flag to override system packages (e.g. numpy) with Cirq's deps.
RUN pip3 install --prefer-binary cirq-core

# Copy relevant files
COPY ./pybind_interface/ /qsim/pybind_interface/
COPY ./qsimcirq/ /qsim/qsimcirq/
Expand All @@ -23,8 +11,5 @@ WORKDIR /qsim/
# Build pybind code early to cache the results
RUN make -C /qsim/ pybind

# Install pytest
RUN pip3 install pytest

# Compile and run qsim tests
ENTRYPOINT make -C /qsim/ run-py-tests
5 changes: 1 addition & 4 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Base OS
FROM qsim

# Install additional requirements
RUN apt-get install -y cmake git

# Copy relevant files
COPY ./tests/ /qsim/tests/

WORKDIR /qsim/

# Compile and run qsim tests
ENTRYPOINT make -C /qsim/ run-cxx-tests
ENTRYPOINT make -C /qsim/ run-cxx-tests
Loading