-
Notifications
You must be signed in to change notification settings - Fork 91
/
Dockerfile
50 lines (37 loc) · 1.38 KB
/
Dockerfile
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
# The build-stage image:
FROM continuumio/miniconda3 AS build
# Install the package as normal:
COPY qdk/environment.yml .
RUN conda env create -f environment.yml
# Install conda-pack:
RUN conda install -c conda-forge conda-pack
# Use conda-pack to create a standalone enviornment
# in /venv:
RUN conda-pack -n qdk -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
# We've put venv in same path it'll be in final image,
# so now fix up paths:
RUN /venv/bin/conda-unpack
# This uses the latest Docker image built from the samples repository,
# defined by the Dockerfile in the Quantum repository
# (folder: /Build/images/samples).
FROM mcr.microsoft.com/quantum/samples:latest
# Copy /venv from the previous stage:
COPY --from=build /venv /venv
# Mark that this Docker environment is hosted within qdk-python
ENV IQSHARP_HOSTING_ENV=qdk-python
# Make sure the contents of our repo are in ${HOME}.
# These steps are required for use on mybinder.org.
USER root
COPY . /src
COPY examples ${HOME}
# Install qdk-python in development mode
SHELL ["/bin/bash", "-c"]
RUN source /venv/bin/activate && pip install -e /src/qdk
RUN chown -R ${USER} ${HOME}
# Finish by dropping back to the notebook user
USER ${USER}
# When image is run, start jupyter notebook within the environment
ENTRYPOINT source /venv/bin/activate && \
jupyter notebook --ip 0.0.0.0