-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (46 loc) · 2.1 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
# Usage:
#
# 1) Get OMEGACEN_CONDA_CREDENTIALS from https://metis.strw.leidenuniv.nl/wiki/doku.php?id=ait:archive
# export OMEGACEN_CONDA_CREDENTIALS=username:password
#
# 2) Build the image
# DOCKER_BUILDKIT=1 docker build --secret id=OMEGACEN_CONDA_CREDENTIALS,env=OMEGACEN_CONDA_CREDENTIALS -t metiswise .
#
# 3) Run the image
# docker run -it --network=host --volume="/:/hostroot" --volume="${XAUTHORITY:-$HOME/.Xauthority}:/home/metis/.Xauthority:ro" --env DISPLAY="${DISPLAY}" metiswise
# TODO: Update Python version
# 23.10.0-1 is the last one with Python 3.11
FROM continuumio/miniconda3:23.10.0-1
MAINTAINER Hugo Buddelmeijer <[email protected]>
# User as prescribed in
# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html
ARG NB_USER=metis
# TODO: Somehow put user ID of account that builds this here
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
RUN adduser --uid ${NB_UID} ${NB_USER}
RUN chown -R ${NB_UID} ${HOME}
# See install_dependencies_debian.sh for these commands.
# They are repeated here to allow docker to cache layers.
RUN \
apt-get update; \
apt-get upgrade -y; \
apt-get install -y file less emacs curl vim man-db meld tmux apt-file x11-apps inetutils-ping; \
apt-file update;
RUN --mount=type=secret,id=OMEGACEN_CONDA_CREDENTIALS \
conda update -y -n base -c defaults conda; \
conda config --add channels defaults; \
conda config --add channels conda-forge; \
conda config --add channels omegacen; \
conda config --add channels "https://$(cat /run/secrets/OMEGACEN_CONDA_CREDENTIALS)@conda.astro-wise.org/"; \
conda install -y --solver=classic conda-forge::conda-libmamba-solver conda-forge::libmamba conda-forge::libmambapy conda-forge::libarchive; \
conda install -y common psycopg2 astropy pytest jupyter httpcore lxml httpx docutils pooch scipy;
# Copy over the repository. This breaks the caching.
COPY . ${HOME}/MetisWISE
# Install
#RUN bash -l ${HOME}/MetisWISE/toolbox/install_dependencies_debian.sh
# TODO: Enable NB_USER again
#USER ${NB_USER}
RUN bash -l ${HOME}/MetisWISE/toolbox/install_run_as_user.sh