Commit d0dbe480 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Move and update the Dockerfile which provides the basis for the notebook...

Move and update the Dockerfile which provides the basis for the notebook related to third party warnings. This notebook is also added to CI.
parent 1fe0b909
Pipeline #249037 passed with stage
in 30 minutes and 20 seconds
......@@ -41,4 +41,17 @@ build_fedora:
- docker build -f docker/Dockerfile_full -t $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:${TAG} -t $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:latest .
- docker container prune
- docker push $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:${TAG}
- if [ "${UPDATE_LATEST_TAG}" == "True" ]; then docker push $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:latest; fi
\ No newline at end of file
- if [ "${UPDATE_LATEST_TAG}" == "True" ]; then docker push $CI_REGISTRY/$CI_PROJECT_PATH/fedora_for_tp:latest; fi
build_boost:
stage: build
retry: 2
only:
- web
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# Latest is always generated but not pushed if ${UPDATE_LATEST_TAG} is not "True"
- docker build -f docker/Dockerfile_full -t $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:${TAG} -t $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:latest .
- docker container prune
- docker push $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:${TAG}
- if [ "${UPDATE_LATEST_TAG}" == "True" ]; then docker push $CI_REGISTRY/$CI_PROJECT_PATH/with_boost:latest; fi
\ No newline at end of file
......@@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall -
add_executable(simple_boost simple_boost.cpp)
# Not portable at all but not the point here!
target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include")
target_include_directories(simple_boost PUBLIC "/opt/include")
target_link_libraries(simple_boost
/Codes/ThirdParty/opt/lib/libboost_filesystem.a
/Codes/ThirdParty/opt/lib/libboost_system.a)
\ No newline at end of file
/opt/lib/libboost_filesystem.a
/opt/lib/libboost_system.a)
\ No newline at end of file
......@@ -29,8 +29,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall -
add_executable(simple_boost simple_boost.cpp)
# Not portable at all but not the point here!
target_include_directories(simple_boost SYSTEM PUBLIC "/Codes/ThirdParty/opt/include")
target_include_directories(simple_boost SYSTEM PUBLIC "/opt/include")
target_link_libraries(simple_boost
/Codes/ThirdParty/opt/lib/libboost_filesystem.a
/Codes/ThirdParty/opt/lib/libboost_system.a)
\ No newline at end of file
/opt/lib/libboost_filesystem.a
/opt/lib/libboost_system.a)
\ No newline at end of file
......@@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall -
add_executable(simple_boost simple_boost.cpp)
# Not portable at all but not the point here!
target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include")
target_include_directories(simple_boost PUBLIC "/opt/include")
target_link_libraries(simple_boost
/Codes/ThirdParty/opt/lib/libboost_filesystem.a
/Codes/ThirdParty/opt/lib/libboost_system.a)
\ No newline at end of file
/opt/lib/libboost_filesystem.a
/opt/lib/libboost_system.a)
\ No newline at end of file
......@@ -22,6 +22,7 @@
#pragma clang diagnostic ignored "-Wsuggest-override" // added in 2021!
#pragma clang diagnostic ignored "-Wsuggest-destructor-override" // added in 2021!
#pragma clang diagnostic ignored "-Wc11-extensions" // added in 2021!
#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override" // added in 2021!
#include "boost/exception/diagnostic_information.hpp"
#include "boost/filesystem.hpp"
......
......@@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall -
add_executable(simple_boost simple_boost.cpp)
# Not portable at all but not the point here!
target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include")
target_include_directories(simple_boost PUBLIC "/opt/include")
target_link_libraries(simple_boost
/Codes/ThirdParty/opt/lib/libboost_filesystem.a
/Codes/ThirdParty/opt/lib/libboost_system.a)
\ No newline at end of file
/opt/lib/libboost_filesystem.a
/opt/lib/libboost_system.a)
\ No newline at end of file
......@@ -23,6 +23,7 @@
#pragma clang diagnostic ignored "-Wsuggest-override" // added in 2021!
#pragma clang diagnostic ignored "-Wsuggest-destructor-override" // added in 2021!
#pragma clang diagnostic ignored "-Wc11-extensions" // added in 2021!
#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override" // added in 2021!
#include "boost/exception/diagnostic_information.hpp"
#include "boost/filesystem.hpp"
......
......@@ -28,8 +28,8 @@ add_cxx_compiler_flag("-Wsign-conversion") # a triggered warning in gcc (-Wall -
add_executable(simple_boost simple_boost.cpp)
# Not portable at all but not the point here!
target_include_directories(simple_boost PUBLIC "/Codes/ThirdParty/opt/include")
target_include_directories(simple_boost PUBLIC "/opt/include")
target_link_libraries(simple_boost
/Codes/ThirdParty/opt/lib/libboost_filesystem.a
/Codes/ThirdParty/opt/lib/libboost_system.a)
\ No newline at end of file
/opt/lib/libboost_filesystem.a
/opt/lib/libboost_system.a)
\ No newline at end of file
......@@ -26,6 +26,8 @@ PRAGMA_DIAGNOSTIC(ignored "-Wnon-virtual-dtor")
PRAGMA_DIAGNOSTIC(ignored "-Wc++98-compat")
PRAGMA_DIAGNOSTIC(ignored "-Wc++98-compat-pedantic")
PRAGMA_DIAGNOSTIC(ignored "-Wexit-time-destructors")
PRAGMA_DIAGNOSTIC(ignored "-Winconsistent-missing-destructor-override")
PRAGMA_DIAGNOSTIC(ignored "-Wsuggest-destructor-override")
#endif // __clang__
#include "boost/exception/diagnostic_information.hpp"
......
# How to use Docker for this example?
First of all, make sure [Docker](https://www.docker.com/) is properly installed and running.
The image is based on Fedora and is created through this [Dockerfile](../docker/Dockerfile.boost).
## Getting the image
Then to get the relevant image you may either:
### Build the image from the provided Dockerfile
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 .
````
This may take few minutes.
### Or fetching it from the gitlab registry
Type in a terminal (provided you have an account on the [Inria gitlab](https://gitlab.inria.fr) - if not you may create one easily):
To run it type:
````
docker login registry.gitlab.inria.fr
docker pull registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp/demo_third_party_warning:latest
docker run -it -v $PWD:/home/formation/gettingstartedwithmoderncpp --cap-drop=all registry.gitlab.inria.fr/formations/cpp/gettingstartedwithmoderncpp/with_boost:latest
````
## Running the image
Go in the _Docker/ThirdPartyWarning_ folder and type:
````
docker run -v $PWD:/Codes/ThirdPartyWarning --cap-drop=all -it demo_third_party_warning
````
For those of you not familiar with Docker:
* `-v` creates a mapping between local folder and the /Codes/ThirdPartyWarning folder in the container; this enables you to edit the file from your comfy environment and see the file edited this way in the Docker container.
* `--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).
`third_party_warning` is a Docker **image**; the instantiation of this image obtained after the run command is a **container**.
# Step by step: illustrating the issue
After run, the container is opened and you are in a folder (inside the container) named `/Codes/ThirdPartyWarning`.
......
# See Config /Dockerfile at the root of the project to generate this base image.
FROM formation_cpp_docker_base
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 hostname make && dnf clean packages
# wget is kept separated as the previous line is in commin with Dockerfile.fedora: so cache may be used if both are built on the same machine.
RUN dnf install -y wget && dnf clean packages
RUN mkdir -p Codes/ThirdPartyWarning && mkdir -p Codes/ThirdParty
RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz \
&& tar xzf boost_1_76_0.tar.gz \
&& rm -f boost_1_76_0.tar.gz
WORKDIR Codes/ThirdParty
RUN wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz \
&& tar xzf boost_1_72_0.tar.gz \
&& rm -f boost_1_72_0.tar.gz
WORKDIR boost_1_72_0
WORKDIR boost_1_76_0
RUN ./bootstrap.sh cxxstd=14,17 --prefix=../opt --with-toolset=clang --with-libraries=filesystem,system
RUN ./b2 install link=static toolset=clang variant=debug
WORKDIR /Codes/ThirdPartyWarning
# Create non root user
ENV USER "formation"
RUN useradd --create-home ${USER}
USER ${USER}
WORKDIR /home/${USER}/gettingstartedwithmoderncpp
ENTRYPOINT ["zsh"]
\ No newline at end of file
......@@ -11,4 +11,4 @@ There are several Dockerfiles here:
- [Dockerfile], which creates an image with a Conda environment to run properly Xeus-cling.
- [Dockerfile-full], which creates an image with a Conda environment to run properly Xeus-cling and installs as well local compilers so that they may be invoked from the notebooks (for the 6-InRealEnvironment part).
- [Dockerfile.fedora] which provides an environment with both clang and gcc installed. This notebook is not intended to run the notebooks but may be used to run the TPs.
- [Dockerfile.boost] is used along with [the notebook about third party warnings](../6-InRealEnvironment/4-ThirdParty.ipynb).
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