forked from microsoft/qio-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (47 loc) · 1.89 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
51
52
53
54
55
FROM python:3.7-slim-buster
# Install required Python packages.
RUN pip install --no-cache --upgrade pip && \
pip install --no-cache notebook azure-quantum jupytext
# Install APT prerequisites.
RUN apt-get update && \
apt-get -y install \
# Not strictly needed, but Git is useful for several
# interactive scenarios, so we finish by adding it as
# well. Thankfully, Git is a small dependency (~3 MiB)
# given what we have already installed.
git \
# Used to retrieve node version information.
curl && \
# We clean the apt cache at the end of each apt command so that the caches
# don't get stored in each layer.
apt-get clean && rm -rf /var/lib/apt/lists/
# Get the Azure CLI tool.
ENV AZURE_CLI_VERSION "2.14.2"
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
# Create a user with a home directory.
# Required for mybinder.org
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER=${NB_USER} \
UID=${NB_UID} \
HOME=/home/${NB_USER} \
IQSHARP_HOSTING_ENV=iqsharp-base \
# Some ways of invoking this image will look at the $SHELL environment
# variable instead of chsh, so we set the new user's shell here as well.
SHELL=/bin/bash
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${UID} \
${USER} && \
# Set the new user's shell to be bash when logging in interactively.
chsh -s /bin/bash ${USER}
WORKDIR ${HOME}
# Get the az quantum extension.
RUN az extension add --source https://msquantumpublic.blob.core.windows.net/az-quantum-cli/quantum-latest-py3-none-any.whl --yes
# Make sure the contents of our repo are in ${HOME}.
# These steps are required for use on mybinder.org.
USER root
COPY . ${HOME}
RUN chown -R ${USER} ${HOME}
# Finish by dropping back to the notebook user.
USER ${USER}