-
Notifications
You must be signed in to change notification settings - Fork 201
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (46 loc) · 1.92 KB
/
Dockerfile
File metadata and controls
57 lines (46 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Base OS
FROM ubuntu:24.04 AS qsim-base
# Allow passing this variable in from the outside.
ARG CUDA_PATH
ENV PATH="$CUDA_PATH/bin:$PATH"
# Update package list & install some basic tools we'll need.
# hadolint ignore=DL3009,DL3008
RUN apt-get update && \
apt-get install -y make g++ wget git --no-install-recommends && \
apt-get install -y python3-dev python3-pip python3-venv --no-install-recommends
# 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.28.1/cmake-3.28.1-linux-x86_64.sh && \
sh cmake-3.28.1-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 ./pybind_interface/ /qsim/lib/
COPY ./qsimcirq_tests/ /qsim/qsimcirq_tests/
COPY ./requirements.txt /qsim/requirements.txt
COPY ./pyproject.toml /qsim/pyproject.toml
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="/qsim/test_env/bin:$PATH"
# Install qsim requirements.
RUN python3 -m pip install --no-cache-dir -r requirements.txt --group dev
# Compile qsim.
RUN make -j qsim
ENTRYPOINT ["/qsim/apps/qsim_base.x"]