Mentions légales du service

Skip to content
Snippets Groups Projects
Commit a2dba4d5 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Rewrite partly the Dockerfile so that:

- The image is derived from continuumio/miniconda3 rather than Ubuntu (maybe it is not the right call - no clue one way or another, but we probably have shave off a bit of space. The miniconda one is apparently base on Debian).
- The project is no longer cloned from gitlab, but is rather read from the host (the command line is therefore a bit longer and is documented in the README). The reason for doing so is that the image is lighter and fork may build their own image from their actual master branch rather than silently taking the one from the main project.

I have also removed several lines that seems to add nothing; maybe I was wrong on some of these calls.

The terminal where the `run` command is run is no longer silent; I don't know what triggered the difference here.
parent c39f92da
No related branches found
No related tags found
No related merge requests found
Pipeline #245452 passed
......@@ -69,7 +69,7 @@ __NOTE__: It is possible to use the notebooks directly from some IDEs like [VSCo
It is possible to execute the notebooks from a Docker machine by simply:
```
docker run -p 8888:8888 registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp:latest
docker run -v $PWD:/home/formation/gettingstartedwithmoderncpp -p 8888:8888 registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp:latest
```
The simply in your browser just simply go to [http://localhost:8888/](http://localhost:8888/).
......
# Each instruction in this file generates a new layer that gets pushed to your local image cache
# Inspired from https://pythonspeed.com/articles/activate-conda-dockerfile
FROM continuumio/miniconda3
# Lines preceeded by # are regarded as comments and ignored
LABEL maintainer Vicente Mataix Ferrandiz "vicente.mataix-ferrandiz@inria.fr" and Sébastien Gilles "sebastien.gilles@inria.fr"
# 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"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y clean
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y \
nano \
bash \
wget \
curl \
git \
cmake \
clang \
build-essential && \
apt-get autoremove -y
RUN apt-get -y clean
# Creation of a "non-root" user
# Create non root user and give him the ownership of /opt/conda.
ENV USER "formation"
RUN useradd --create-home ${USER}
RUN chown ${USER}:${USER} /opt/conda
USER ${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}
RUN git clone https://gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp.git
# Create the environment:
WORKDIR /home/${USER}/gettingstartedwithmoderncpp
COPY environment.yml .
RUN conda env create -f environment.yml
# Change the default shell to be bash
# Make RUN commands use the new environment:
SHELL ["/bin/bash", "-c"]
# Conda environment
WORKDIR /home/${USER}/gettingstartedwithmoderncpp
# RUN echo ". /home/${USER}/miniconda3/etc/profile.d/conda.sh" >> ~/.bashrc
RUN /home/${USER}/miniconda3/bin/conda env create -f environment.yml
RUN /home/${USER}/miniconda3/bin/conda init bash
# RUN source ~/.bashrc
RUN source /home/${USER}/miniconda3/etc/profile.d/conda.sh
RUN /home/${USER}/miniconda3/bin/conda clean -a
# 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", "-n", "training_cpp_2021", "jupyter", "lab", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root","--NotebookApp.token=''"]
# The code to run when container is started:
# Using informations from https://hub.docker.com/r/continuumio/miniconda3 and options used by Vicente in former Docker file based on Ubuntu.
ENTRYPOINT [ "conda", "run", "--no-capture-output", "-n", "training_cpp_2021", "jupyter", "lab", "--port=8888", "--ip=0.0.0.0", "--no-browser","--allow-root","--NotebookApp.token=''"]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment