Skip to content

Update Dockerfiles and docker-compose.yml files #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# Base OS
FROM debian
FROM ubuntu:24.04

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

# The default version of CMake is 3.28. Get a newer version from Kitware.
RUN apt remove --purge --auto-remove cmake
RUN wget 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/

WORKDIR /qsim/
# Copy Python requirements file for other images based on this one.
COPY ./requirements.txt /qsim/requirements.txt

# Compile qsim
# 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
27 changes: 19 additions & 8 deletions install/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
# 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 wget git

# Create venv to avoid collision between system packages (e.g. numpy) and Cirq's deps.
# The default version of CMake is 3.28. Get a newer version from Kitware.
RUN apt remove --purge --auto-remove cmake
RUN wget 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/
WORKDIR /qsim/

# Use venv to avoid collision between system packages (e.g., NumPy) and our deps
RUN python3 -m venv test_env

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

COPY ./ /qsim/
RUN pip3 install /qsim/
# Install dev requirements
RUN pip3 install -r dev-requirements.txt

# Install qsim from the local sources
RUN pip3 install .

# Run test in a non-qsim directory
# Run tests in a non-qsim directory
COPY ./qsimcirq_tests/ /test-install/

WORKDIR /test-install/
Expand Down
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
4 changes: 2 additions & 2 deletions pybind_interface/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ 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
# Install qsim requirements
RUN pip3 install -r ./requirements.txt

# Copy relevant files
COPY ./pybind_interface/ /qsim/pybind_interface/
Expand Down
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