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
Pipeline #245452 passed with stage
in 7 minutes and 56 seconds
......@@ -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
docker run -v $PWD:/home/formation/gettingstartedwithmoderncpp -p 8888:8888
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
FROM continuumio/miniconda3
# Lines preceeded by # are regarded as comments and ignored
LABEL maintainer Vicente Mataix Ferrandiz "" and Sébastien Gilles ""
# 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=""
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
# Default working directory is
RUN curl -O
RUN bash -b
RUN rm -rf
# Changing to home
RUN git clone
# 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/" >> ~/.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/
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=", "--allow-root","--NotebookApp.token=''"]
# The code to run when container is started:
# Using informations from 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=", "--no-browser","--allow-root","--NotebookApp.token=''"]
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment