Dockerfile_full 1.64 KB
Newer Older
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
1
2
3
4
5
6
7
8
9
10
# Each instruction in this file generates a new layer that gets pushed to your local image cache

# Lines preceeded by # are regarded as comments and ignored

# The line below states we will base our new image on the Latest Official Ubuntu
FROM ubuntu:latest

# Identify the maintainer of an image
LABEL maintainer="vicente.mataix-ferrandiz@inria.fr"

Vicente Mataix Ferrándiz's avatar
Revert    
Vicente Mataix Ferrándiz committed
11
ENV DEBIAN_FRONTEND=noninteractive
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
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
RUN apt-get -y clean
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y \
    nano               \
    bash               \
    wget               \
    curl               \
    cmake              \
    build-essential && \
    apt-get autoremove -y
RUN apt-get -y clean

# Creation of a "non-root" user
ENV USER "formation"
RUN useradd --create-home ${USER}

# Default working directory is
WORKDIR /home/${USER}
RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -b
RUN rm -rf Miniconda3-latest-Linux-x86_64.sh

# Changing to home
WORKDIR /home/${USER}
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
37
USER ${USER}
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
38

Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
39
# Create the environment:
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
40
WORKDIR /home/${USER}/gettingstartedwithmoderncpp
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
41
42
COPY environment.yml .
RUN /home/${USER}/miniconda3/bin/conda env create -f environment.yml 
Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
43
44
RUN /home/${USER}/miniconda3/bin/conda clean -a

Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
45
46
47
# Change the default shell to be bash
SHELL ["/bin/bash", "-c"]

Vicente Mataix Ferrándiz's avatar
Vicente Mataix Ferrándiz committed
48
49
50
51
52
# Add to the bashrc
RUN echo "alias python=\"python3\"" >> ~/.bashrc
RUN echo "conda activate training_cpp_2021" >> ~/.bashrc
RUN source ~/.bashrc
CMD ["/home/formation/miniconda3/bin/conda", "run", "--no-capture-output", "-n", "training_cpp_2021", "jupyter", "lab", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root","--NotebookApp.token=''"]