|
| 1 | +# ref: https://hub.docker.com/_/rockylinux |
| 2 | +FROM rockylinux:9 AS env |
| 3 | + |
| 4 | +############# |
| 5 | +## SETUP ## |
| 6 | +############# |
| 7 | +ENV PATH=/usr/local/bin:$PATH |
| 8 | +RUN dnf -y update \ |
| 9 | +&& dnf -y install git wget openssl-devel cmake \ |
| 10 | +&& dnf -y groupinstall "Development Tools" \ |
| 11 | +&& dnf clean all \ |
| 12 | +&& rm -rf /var/cache/dnf |
| 13 | +CMD [ "/usr/bin/bash" ] |
| 14 | + |
| 15 | +# Install SWIG 4.2.1 |
| 16 | +FROM base AS swig |
| 17 | +RUN dnf -y update \ |
| 18 | +&& dnf -y install pcre2-devel \ |
| 19 | +&& dnf clean all \ |
| 20 | +&& rm -rf /var/cache/dnf \ |
| 21 | +&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \ |
| 22 | +&& tar xvf swig-4.2.1.tar.gz \ |
| 23 | +&& rm swig-4.2.1.tar.gz \ |
| 24 | +&& cd swig-4.2.1 \ |
| 25 | +&& ./configure --prefix=/usr \ |
| 26 | +&& make -j 4 \ |
| 27 | +&& make install \ |
| 28 | +&& cd .. \ |
| 29 | +&& rm -rf swig-4.2.1 |
| 30 | + |
| 31 | +# Install .Net |
| 32 | +# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install |
| 33 | +RUN wget -q "https://dot.net/v1/dotnet-install.sh" \ |
| 34 | +&& chmod a+x dotnet-install.sh \ |
| 35 | +&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \ |
| 36 | +&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin |
| 37 | +# Trigger first run experience by running arbitrary cmd |
| 38 | +RUN dotnet --info |
| 39 | + |
| 40 | +# Java Install |
| 41 | +RUN dnf -y update \ |
| 42 | +&& dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \ |
| 43 | +&& dnf clean all \ |
| 44 | +&& rm -rf /var/cache/dnf |
| 45 | + |
| 46 | +# Install Python |
| 47 | +RUN dnf -y update \ |
| 48 | +&& dnf -y install python3-devel python3-pip python3-numpy \ |
| 49 | +&& dnf clean all \ |
| 50 | +&& rm -rf /var/cache/dnf |
| 51 | +RUN python3 -m pip install \ |
| 52 | + absl-py mypy mypy-protobuf pandas |
| 53 | + |
| 54 | +################ |
| 55 | +## OR-TOOLS ## |
| 56 | +################ |
| 57 | +FROM env AS devel |
| 58 | +ENV DISTRIBUTION=rockylinux-9 |
| 59 | + |
| 60 | +WORKDIR /root |
| 61 | +# Copy the snk key |
| 62 | +COPY or-tools.snk /root/or-tools.snk |
| 63 | +ENV DOTNET_SNK=/root/or-tools.snk |
| 64 | + |
| 65 | +ARG SRC_GIT_BRANCH |
| 66 | +ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-main} |
| 67 | +ARG SRC_GIT_SHA1 |
| 68 | +ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown} |
| 69 | + |
| 70 | +ARG OR_TOOLS_PATCH |
| 71 | +ENV OR_TOOLS_PATCH ${OR_TOOLS_PATCH:-9999} |
| 72 | + |
| 73 | +# Download sources |
| 74 | +# use SRC_GIT_SHA1 to modify the command |
| 75 | +# i.e. avoid docker reusing the cache when new commit is pushed |
| 76 | +SHELL ["/bin/bash", "-c"] |
| 77 | +RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch --depth=1 https://github.com/google/or-tools \ |
| 78 | +&& [[ $(cd or-tools && git rev-parse --verify HEAD) == ${SRC_GIT_SHA1} ]] |
| 79 | +WORKDIR /root/or-tools |
| 80 | + |
| 81 | +# C++ |
| 82 | +## build |
| 83 | +FROM devel AS cpp_build |
| 84 | +RUN make detect_cpp \ |
| 85 | +&& make cpp JOBS=8 |
| 86 | +## archive |
| 87 | +FROM cpp_build AS cpp_archive |
| 88 | +RUN make archive_cpp |
| 89 | + |
| 90 | +# .Net |
| 91 | +## build |
| 92 | +FROM cpp_build AS dotnet_build |
| 93 | +ENV USE_DOTNET_CORE_31=ON |
| 94 | +RUN make detect_dotnet \ |
| 95 | +&& make dotnet JOBS=8 |
| 96 | +## archive |
| 97 | +FROM dotnet_build AS dotnet_archive |
| 98 | +RUN make archive_dotnet |
| 99 | + |
| 100 | +# Java |
| 101 | +## build |
| 102 | +FROM cpp_build AS java_build |
| 103 | +RUN make detect_java \ |
| 104 | +&& make java JOBS=8 |
| 105 | +## archive |
| 106 | +FROM java_build AS java_archive |
| 107 | +RUN make archive_java |
| 108 | + |
| 109 | +# Python |
| 110 | +## build |
| 111 | +FROM cpp_build AS python_build |
| 112 | +RUN make detect_python \ |
| 113 | +&& make python JOBS=8 |
| 114 | +## archive |
| 115 | +FROM python_build AS python_archive |
| 116 | +RUN make archive_python |
0 commit comments