From 64918d76b50a27428fe91b30471dbe97197b8366 Mon Sep 17 00:00:00 2001 From: h-fournier Date: Fri, 13 Dec 2024 14:42:43 +0100 Subject: [PATCH] Add missing files for CentOs --- docker/AntaresDeps | 37 ++++++++++++++++++ docker/Dockerfile | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 docker/AntaresDeps create mode 100644 docker/Dockerfile diff --git a/docker/AntaresDeps b/docker/AntaresDeps new file mode 100644 index 0000000000..bfe47cb44e --- /dev/null +++ b/docker/AntaresDeps @@ -0,0 +1,37 @@ +FROM centos:7 + +ENV LANG=en_US.UTF-8 \ + LC_ALL=en_US.UTF-8 \ + DEBIAN_FRONTEND=noninteractive \ + VCPKG_ROOT=/vcpkg \ + ORTOOLS_DIR=ortools + +CMD ["/bin/bash"] + +# Install requirements : update repo +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo &&\ + yum install -y epel-release &&\ + yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils python3 &&\ + sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\ + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo + +RUN yum update -y +RUN yum install -y epel-release +RUN yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils rpm-build && \ + yum install -y devtoolset-11 && \ + yum install -y rh-git227-git ccache +RUN yum install -y unzip libuuid-devel wxGTK3-devel +RUN yum install -y python3-pip && python3 -m pip install --upgrade pip && pip3 install pytest numpy pandas + +# Install requirements +RUN rm -rf /var/cache/yum + +RUN echo "source /opt/rh/devtoolset-11/enable" >> /etc/bashrc +SHELL ["/bin/bash", "--login", "-c"] + +# Install CMake +RUN pip3 install cmake==3.28.4 + diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..17a21b3063 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,95 @@ +FROM antaresrte/antaressystemdeps:latest + + + +CMD ["/bin/bash"] + +RUN mkdir /workspace + +RUN echo "source /opt/rh/devtoolset-11/enable" >> /etc/bashrc +SHELL ["/bin/bash", "--login", "-c"] + + +RUN mkdir -p /workspace/vcpkg_cache +ARG VCPKG_CACHE_DIR +COPY $VCPKG_CACHE_DIR /workspace/ + + +ARG BRANCH=develop +RUN cd /workspace && \ + git clone https://github.com/AntaresSimulatorTeam/Antares_Simulator.git --branch $BRANCH && \ + cd Antares_Simulator && \ + git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics && \ + export VCPKG_ROOT=/workspace/Antares_Simulator/vcpkg + + + + + +RUN ORTOOLS_TAG=$(cat /workspace/Antares_Simulator/ortools_tag) && \ + echo "ORTOOLS_TAG=$ORTOOLS_TAG" && \ + URL_ORTOOLS=https://github.com/rte-france/or-tools-rte/releases/download/$ORTOOLS_TAG/ortools_cxx_centos7_static_sirius.zip && \ + mkdir -p ortools && cd ortools && \ + wget -q -O ortools.zip $URL_ORTOOLS && \ + unzip -q ortools.zip && \ + rm ortools.zip + +WORKDIR /workspace/Antares_Simulator +# Accept build arguments for ccache +ARG CCACHE_DIR +ARG CCACHE_KEY + +# Copy ccache directory into the container +COPY ${CCACHE_DIR:-/dev/null} /workspace/.ccache + +# Configure ccache environment variables +ENV CCACHE_DIR=/workspace/.ccache +ENV CCACHE_BASEDIR=/workspace +ENV CCACHE_COMPRESS=1 +ENV PATH="/usr/lib/ccache:$PATH" + +RUN source /opt/rh/devtoolset-11/enable && \ + source /opt/rh/rh-git227/enable && \ + export VCPKG_BINARY_SOURCES="clear;files,/workspace/vcpkg_cache,readwrite" && \ + cmake -B _build -S src \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_TOOLCHAIN_FILE=/workspace/Antares_Simulator/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux-release \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=OFF \ + -DBUILD_TOOLS=ON \ + -DBUILD_UI=OFF \ + -DCMAKE_PREFIX_PATH=/ortools/install + +ARG NPROC=2 +RUN source /opt/rh/devtoolset-11/enable && \ + source /opt/rh/rh-git227/enable && \ + export VCPKG_BINARY_SOURCES="clear;files,/workspace/vcpkg_cache,readwrite" && \ + cmake --build _build --config Release -j${NPROC} &&\ + ccache -s + +#Installer .rpm creation +RUN cd _build && \ + cpack -G RPM + +#Solver archive creation +RUN cd _build && \ + cpack -G RPM + +RUN cd _build && \ + cmake --install . --prefix install && \ + pushd . && \ + cd install/bin && \ + tar czf ../../antares-solver_centos7.tar.gz antares-solver libsirius_solver.so && \ + popd && \ + rm -rf install + +#.tar.gz creation +RUN cd _build && \ + cpack -G TGZ +#mv .rpm and .tar.gz +RUN cd _build && \ + mkdir archive && \ + mv *.tar.gz archive && \ + mv *.rpm archive