Mentions légales du service

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

Refactor a bit the way Docker images are used; the third party warnings are...

Refactor a bit the way Docker images are used; the third party warnings are now a full-fledged demo.
parent fbbf8440
No related branches found
No related tags found
No related merge requests found
FROM fedora:latest # See COnfig /Dockerfile at the root of the project to generate this base image.
FROM formation_cpp_docker_base
LABEL maintainer Sébastien Gilles "sebastien.gilles@inria.fr" LABEL maintainer Sébastien Gilles "sebastien.gilles@inria.fr"
RUN (dnf update -y && dnf upgrade -y -q) RUN (dnf update -y && dnf upgrade -y -q)
RUN dnf install -y git cmake clang gcc gcc-c++ ninja-build wget which && dnf clean packages RUN dnf install -y wget && dnf clean packages
RUN mkdir -p Codes/ThirdPartyWarning && mkdir -p Codes/ThirdParty RUN mkdir -p Codes/ThirdPartyWarning && mkdir -p Codes/ThirdParty
...@@ -16,8 +17,8 @@ RUN wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar. ...@@ -16,8 +17,8 @@ RUN wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.
WORKDIR boost_1_72_0 WORKDIR boost_1_72_0
RUN ./bootstrap.sh cxxstd=14,17 --prefix=../opt --with-toolset=clang --with-libraries=filesystem,system RUN ./bootstrap.sh cxxstd=14,17 --prefix=../opt --with-toolset=clang --with-libraries=filesystem,system
RUN ./b2 install link=static toolset=clang variant=debug RUN ./b2 install link=static toolset=clang variant=debug
WORKDIR /Codes/ThirdPartyWarning WORKDIR /Codes/ThirdPartyWarning
ENTRYPOINT ["bash"] ENTRYPOINT ["zsh"]
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,9 @@ Then to get the relevant image you may either: ...@@ -8,7 +8,9 @@ Then to get the relevant image you may either:
### Build the image from the provided Dockerfile ### Build the image from the provided Dockerfile
Type in a terminal: Make sure to have first built the image in Config directory (at the root of the project).
Then type in a terminal:
```` ````
docker build -t demo_third_party_warning . docker build -t demo_third_party_warning .
......
FROM fedora:latest
LABEL maintainer Sébastien Gilles "sebastien.gilles@inria.fr"
RUN (dnf update -y && dnf upgrade -y -q)
RUN dnf install -y git cmake clang gcc gcc-c++ ninja-build which zsh hostname make && dnf clean packages
COPY zshrc /root/.zshrc
ENTRYPOINT ["zsh"]
This directory includes several utilities used in the TPs and demos...
The Dockerfile here is not meant to be used directly bbut the ones for TPs and the demo about third party warnings are bbuilt upon it.
To build it, run:
````
docker build -t formation_cpp_docker_base .
````
\ No newline at end of file
# ----------------------------------------------------------------------------
# Zshrc
# Author : Grubly
# Patched by : Milipili, f00ty
# ----------------------------------------------------------------------------
# --------------------------------------------------------------- Settings ---
USER=`whoami`
OS=`uname -s`
MYEDITOR="vim"
HISTSIZE=10000
export LC_ALL='en_US.UTF-8'
# ------------------------------------------------------ ZSH Configuration ---
if [ -f /etc/profile ]; then
source /etc/profile 2>/dev/null >/dev/null
fi
## Am I a special user ??
if (( EUID == 0 )); then
superUser="yes";
else
groups | egrep "wheel|adm|staff|sys|es" > /dev/null
if [ "$?" -eq 0 ]; then
superUser="yes";
else
superUser="no";
fi;
fi;
## Eterm is not recognised by most OSes
if [[ $TERM = "Eterm" ]] ; then
case $OS in
Linux)
export TERM=Eterm
;;
NetBSD)
export TERM=xterm
;;
*)
export TERM=xterm-color
;;
esac
fi
## xterm is not recognized by NetBSD (1.6)
if [[ $TERM = "xterm-color" ]] ; then
case $OS in
NetBSD)
export TERM=xterm
;;
esac
fi
# Default umask
umask 022
if [ "$OS" = 'FreeBSD' ]; then
export EDITOR="/usr/local/bin/$MYEDITOR"
else
export EDITOR="/usr/bin/$MYEDITOR"
fi
addExportPath()
{
if [ -d "$1" ] ; then
if [ ! "$2" = "" -a -d "$2" ]; then
export PATH="$2:$PATH"
fi
export PATH="$1:$PATH"
fi
}
addExportPath '/sw/bin' '/sw/sbin'
addExportPath '/usr/bin' '/usr/sbin'
addExportPath '/bin' '/sbin'
addExportPath '/usr/local/bin' '/usr/local/sbin'
addExportPath '/opt/local/bin' '/opt/local/sbin'
# Misc options
setopt correct
setopt correct_all
setopt auto_cd
setopt hist_ignore_dups
setopt auto_list
setopt append_history
setopt auto_param_keys
setopt auto_param_slash
setopt bg_nice
setopt complete_aliases
setopt equals
setopt extended_glob
setopt hash_cmds
setopt hash_dirs
setopt mail_warning
setopt magic_equal_subst
setopt numericglobsort
setopt pushd_ignore_dups
setopt printeightbit
unsetopt beep
# Filename suffixes to ignore during completion
#fignore=(.o .c~ .pro)
## Prevent CVS/SVN files/directories from being completed
#zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
#zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
#zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)svn'
#zstyle ':completion:*:cd:*' ignored-patterns '(*/)#svn'
# ignore patterns you don't have
zstyle ':completion:*:functions' ignored-patterns '_*'
## set colors for GNU ls ; set this to right file
if [ "$SHELL" = '' ]; then # fixing
export SHELL=`which zsh`
fi
my_ls=ls
which gls > /dev/null
if [ $? -eq 0 ]; then
my_ls=gls
fi
which dircolors > /dev/null
if [ $? -eq 0 ]; then
#eval `dircolors`
export LS_COLORS="no=00:fi=00:di=00;36:ln=00;32:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:"
ls=$my_ls' -F --color=always'
else
## dircolors not availaible, try gdircolors
which gdircolors > /dev/null
if [ $? -eq 0 ]; then
eval `gdircolors -b | sed 's/;34/;36/g'`
ls=$my_ls' --color=auto'
alias df='gdf'
else
## GNU ls not available, using other one.
export LS_COLORS="no=00:fi=00:di=00;36:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:"
case $OS in
FreeBSD)
export BLOCKSIZE=K
export CLICOLOR=enable
autoload -U is-at-least
export LS_COLORS="gxfxBxcxbxegedabagacad"
ls='ls -F'
;;
OpenBSD|NetBSD|Darwin|SunOS)
ls='ls -F -G'
;;
esac
fi
fi
# Doesn't work here!
#export LSCOLORS="$LS_COLORS"
# Aliases
alias l='ls -lh'
alias ll='ls -l'
alias la='ls -A'
# Good prompts
autoload -U colors
colors
path_color="yellow"
sym_color="cyan"
time_color="white"
err_color="red"
num_color="blue"
computer_color="cyan"
if [ "$USER" = "root" ]; then
login_color="red"
else
login_color="green"
fi
cpath="%B%{$fg[$path_color]%}%30<...<%~%b"
psym="%{$fg[$sym_color]%}%%"
plogin="%{$fg[$login_color]%}[$USER]"
time="%{$fg[$time_color]%}%T"
error="%B%{$fg[$err_color]%}Err %?%b"
reset="%{$reset_color%}"
num="%{$fg[$num_color]%}#%h"
computer="%b%{$fg[$computer_color]%}`hostname | cut -d"." -f1`%B"
PS1="$computer $plogin $cpath $psym $reset"
RPS1="%(?,$time,$error) $num$reset"
# Completion options
autoload mere zed zfinit
autoload incremental-complete-word
zle -N incremental-complete-word
# Always use emacs-mode
bindkey -e
# Bindkeys, easier life.
bindkey i incremental-complete-word
bindkey  history-incremental-search-backward
bindkey \[1~ beginning-of-line
bindkey \[7~ beginning-of-line
bindkey \[4~ end-of-line
bindkey  beginning-of-line
bindkey  end-of-line
bindkey kill-line
bindkey  kill-whole-line
bindkey  yank
bindkey  vi-forward-word
bindkey  vi-backward-word
autoload insert-files
autoload nslookup
autoload predict-on
autoload compinit
autoload complist
compinit
zstyle ':completion:*' format '%{%}--- %{%}%d%{%}'
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _complete _correct _approximate
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'l:|=* r:|=*' 'r:|[
._-]=* r:|=*'
zstyle ':completion:*' max-errors 2
zstyle ':completion:*' menu select=5
zstyle ':completion:*' original true
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' verbose true
zstyle ':completion:*:processes' list-colors '=(#b)(?????)(#B)?????????????????????????????????([^ ]#/)#(#b)([^ /]#)*=00=01;31=01;33'
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:rm:*' ignore-line yes
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
zstyle ':completion:*:*:xdvi:*' menu yes select
zstyle ':completion:*:*:xdvi:*' file-sort time
# On the fly hostname list
if [ -f "${HOME}/.ssh/known_hosts" ]; then
allprevioushosts="`cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e 's/,.*//g' | uniq | grep -v "\[" | tr '\n' ' '`"
else
allprevioushosts=''
fi
zstyle '*:hosts' hosts localhost `echo ${allprevioushosts}`
export EDITOR=$MYEDITOR
# LS
case $OS in
FreeBSD) alias ls="$ls -w";;
Darwin|Linux) alias ls="$ls -v";;
OpenBSD|NetBSD|SunOS) alias ls="$ls" ;;
*) alias ls="$ls" ;;
esac
# Aliases
alias l='ls -lh'
alias ll='ls -l'
alias la='ls -A'
alias rm='rm -i'
if [ "$OS" = 'Darwin' ]; then # Hack pour Terminal
export TERM='xterm-color'
fi
if [ "$OS" = 'Linux' ]; then
if [ ! "`which htop`" = '' ]; then
alias top="htop"
fi
alias grep="grep --color"
fi
# Alias
alias v="vim"
if [ "$OS" = 'Darwin' ]; then
alias log="tail -n 20 /var/log/system.log"
else
alias log="tail -n 20 /var/log/messages"
fi
echo
echo " Welcome "$USER" on `hostname` !"
echo
# Faire fonctionner backspace dans tous les cas
case $TERM in
*xterm*|rxvt|(dt|k|E)term)
bindkey '^?' backward-delete-char
bindkey "^[[3~" delete-char
;;
esac
# Good for you :)
if [ "$TERM" '!=' 'linux' ]; then
precmd() {print -Pn "\e]0;%n@%m: %~\a"}
fi
cmake_minimum_required(VERSION 3.9) cmake_minimum_required(VERSION 3.9)
include(../../cmake/Settings.cmake) include(../Config/cmake/Settings.cmake)
project(GettingStartedWithModernCpp_TP_Procedural) project(GettingStartedWithModernCpp_TP_Procedural)
include(../../cmake/AfterProjectSettings.cmake) include(../Config/cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp) add_executable(initial initial_file.cpp)
# add_executable(exercice1 exercice1.cpp) #add_executable(exercice1 exercice1.cpp)
# add_executable(exercice2 exercice2.cpp) # add_executable(exercice2 exercice2.cpp)
# add_executable(exercice3 exercice3.cpp) # add_executable(exercice3 exercice3.cpp)
# add_executable(exercice4 exercice4.cpp) # add_executable(exercice4 exercice4.cpp)
......
cmake_minimum_required(VERSION 3.9) cmake_minimum_required(VERSION 3.9)
include(../../cmake/Settings.cmake) include(../Config/cmake/Settings.cmake)
project(GettingStartedWithModernCpp_TP_Object) project(GettingStartedWithModernCpp_TP_Object)
include(../../cmake/AfterProjectSettings.cmake) include(../Config/cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp) add_executable(initial initial_file.cpp)
......
cmake_minimum_required(VERSION 3.9) cmake_minimum_required(VERSION 3.9)
include(../../cmake/Settings.cmake) include(../Config/cmake/Settings.cmake)
project(GettingStartedWithModernCpp_TP_Operators) project(GettingStartedWithModernCpp_TP_Operators)
include(../../cmake/AfterProjectSettings.cmake) include(../Config/cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp) add_executable(initial initial_file.cpp)
......
cmake_minimum_required(VERSION 3.9) cmake_minimum_required(VERSION 3.9)
include(../../cmake/Settings.cmake) include(../Config/cmake/Settings.cmake)
project(GettingStartedWithModernCpp_TP_Template) project(GettingStartedWithModernCpp_TP_Template)
include(../../cmake/AfterProjectSettings.cmake) include(../Config/cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp) add_executable(initial initial_file.cpp)
......
cmake_minimum_required(VERSION 3.9) cmake_minimum_required(VERSION 3.9)
include(../../cmake/Settings.cmake) include(../Config/cmake/Settings.cmake)
project(GettingStartedWithModernCpp_TP_ConceptSTL) project(GettingStartedWithModernCpp_TP_ConceptSTL)
include(../../cmake/AfterProjectSettings.cmake) include(../Config/cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp) add_executable(initial initial_file.cpp)
......
cmake_minimum_required(VERSION 3.9) cmake_minimum_required(VERSION 3.9)
include(../../cmake/Settings.cmake) include(../Config/cmake/Settings.cmake)
project(GettingStartedWithModernCpp_TP_RealEnv) project(GettingStartedWithModernCpp_TP_RealEnv)
include(../../cmake/AfterProjectSettings.cmake) include(../Config/cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp) add_executable(initial initial_file.cpp)
......
File moved
FROM fedora:latest FROM formation_cpp_docker_base
LABEL maintainer Sébastien Gilles "sebastien.gilles@inria.fr"
RUN (dnf update -y && dnf upgrade -y -q)
RUN dnf install -y git cmake clang gcc gcc-c++ wget which zsh hostname make && dnf clean packages
COPY Config/zshrc /root/.zshrc
RUN mkdir -p Codes/TP
WORKDIR Codes/TP WORKDIR Codes/TP
......
...@@ -11,7 +11,7 @@ Then to get the relevant image you may either: ...@@ -11,7 +11,7 @@ Then to get the relevant image you may either:
Type in a terminal (in the same folder this README is): Type in a terminal (in the same folder this README is):
```` ````
docker build --no-cache -t tp . docker build -t tp_formation_cpp .
```` ````
This may take few minutes. This may take few minutes.
...@@ -22,15 +22,15 @@ Type in a terminal (provided you have an account on the [Inria gitlab](https://g ...@@ -22,15 +22,15 @@ Type in a terminal (provided you have an account on the [Inria gitlab](https://g
```` ````
docker login registry.gitlab.inria.fr docker login registry.gitlab.inria.fr
docker pull registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp/tp:latest docker pull registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp/tp_formation_cpp:latest
```` ````
## Running the image ## Running the image
Go in the TP folder of the current TP considered (for instance `1-ProceduralProgramming/TP`) and type: Run *from the TP directory of the project* the command:
```` ````
docker run -v $PWD:/Codes/TP --cap-drop=all -it tp docker run -v $PWD:/Codes/TP --cap-drop=all -it tp_formation_cpp
```` ````
For those of you not familiar with Docker: For those of you not familiar with Docker:
...@@ -39,5 +39,5 @@ For those of you not familiar with Docker: ...@@ -39,5 +39,5 @@ For those of you not familiar with Docker:
* `--cap-drop=all` is a safety when you're running a Docker image not built by yourself: you're essentially blocking the few remaining operations that might impact your own environment that Docker lets by default open with the run command. * `--cap-drop=all` is a safety when you're running a Docker image not built by yourself: you're essentially blocking the few remaining operations that might impact your own environment that Docker lets by default open with the run command.
* `-it` tells we want an interactive session: your terminal session will place you inside the container (here a Fedora environment). * `-it` tells we want an interactive session: your terminal session will place you inside the container (here a Fedora environment).
`tp` is a Docker **image**; the instantiation of this image obtained after the run command is a **container**. All the modifications you may do in the container won't be kept when you leave it, except for the files that will have been written in your own filesystem thanks to the `-v` option. `tp_formation_cpp` is a Docker **image**; the instantiation of this image obtained after the run command is a **container**. All the modifications you may do in the container won't be kept when you leave it, except for the files that will have been written in your own filesystem thanks to the `-v` option.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment