91 lines
2.6 KiB
Docker
91 lines
2.6 KiB
Docker
FROM centos:7 AS env
|
|
|
|
#############
|
|
## SETUP ##
|
|
#############
|
|
RUN yum -y update \
|
|
&& yum -y groupinstall 'Development Tools' \
|
|
&& yum -y install wget curl pcre-devel redhat-lsb-core pkgconfig autoconf libtool zlib-devel which \
|
|
&& yum clean all \
|
|
&& rm -rf /var/cache/yum
|
|
|
|
# Bump to gcc-9
|
|
RUN yum -y update \
|
|
&& yum -y install centos-release-scl \
|
|
&& yum -y install devtoolset-9 \
|
|
&& yum clean all \
|
|
&& echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc
|
|
SHELL ["/bin/bash", "--login", "-c"]
|
|
# RUN gcc --version
|
|
|
|
# Install CMake 3.20.1
|
|
RUN wget "https://cmake.org/files/v3.20/cmake-3.20.1-linux-x86_64.sh" \
|
|
&& chmod a+x cmake-3.20.1-linux-x86_64.sh \
|
|
&& ./cmake-3.20.1-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
|
|
&& rm cmake-3.20.1-linux-x86_64.sh
|
|
|
|
# Install Swig 4.0.2
|
|
RUN curl --location-trusted \
|
|
--remote-name "https://downloads.sourceforge.net/project/swig/swig/swig-4.0.2/swig-4.0.2.tar.gz" \
|
|
-o swig-4.0.2.tar.gz \
|
|
&& tar xvf swig-4.0.2.tar.gz \
|
|
&& rm swig-4.0.2.tar.gz \
|
|
&& cd swig-4.0.2 \
|
|
&& ./configure --prefix=/usr \
|
|
&& make -j 4 \
|
|
&& make install \
|
|
&& cd .. \
|
|
&& rm -rf swig-4.0.2
|
|
|
|
# Install Java 8 SDK
|
|
RUN yum -y update \
|
|
&& yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \
|
|
&& yum clean all \
|
|
&& rm -rf /var/cache/yum
|
|
ENV JAVA_HOME=/usr/lib/jvm/java
|
|
|
|
# Install dotnet
|
|
# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-centos#centos-7-
|
|
RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm \
|
|
&& yum -y update \
|
|
&& yum -y install dotnet-sdk-3.1 \
|
|
&& yum clean all \
|
|
&& rm -rf /var/cache/yum
|
|
# Trigger first run experience by running arbitrary cmd
|
|
RUN dotnet --info
|
|
|
|
ENV TZ=America/Los_Angeles
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
################
|
|
## OR-TOOLS ##
|
|
################
|
|
FROM env AS devel
|
|
# Copy the snk key
|
|
COPY or-tools.snk /root/or-tools.snk
|
|
ENV DOTNET_SNK=/root/or-tools.snk
|
|
|
|
ARG SRC_GIT_BRANCH
|
|
ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-master}
|
|
ARG SRC_GIT_SHA1
|
|
ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown}
|
|
|
|
# Download sources
|
|
# use SRC_GIT_SHA1 to modify the command
|
|
# i.e. avoid docker reusing the cache when new commit is pushed
|
|
WORKDIR /root
|
|
RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch https://github.com/google/or-tools \
|
|
&& echo "sha1: $(cd or-tools && git rev-parse --verify HEAD)" \
|
|
&& echo "expected sha1: ${SRC_GIT_SHA1}"
|
|
|
|
# Build third parties
|
|
FROM devel AS third_party
|
|
WORKDIR /root/or-tools
|
|
RUN make detect && make third_party
|
|
|
|
# Build project
|
|
FROM third_party AS build
|
|
RUN make detect_cc && make cc
|
|
RUN make detect_java && make java
|
|
RUN make detect_dotnet && make dotnet
|