Skip to content

Commit

Permalink
tools/docker: Add almalinux-9 and rockylinux-9
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Aug 30, 2024
1 parent 6a89f75 commit c0c54fb
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ help:
# @echo -e "\t\t${BOLD}riscv64 (RISC-V 64bits, experimental)${RESET}"
@echo
@echo -e "\t${BOLD}<distro>${RESET}:"
@echo -e "\t\t${BOLD}almalinux-9${RESET} (latest)"
@echo -e "\t\t${BOLD}alpine-edge${RESET} (latest)"
@echo -e "\t\t${BOLD}archlinux${RESET} (latest)"
@echo -e "\t\t${BOLD}debian-sid${RESET} (unstable)"
Expand All @@ -105,6 +106,7 @@ help:
@echo -e "\t\t${BOLD}ubuntu-22.04${RESET} (Ubuntu 22.04 LTS)"
@echo -e "\t\t${BOLD}ubuntu-20.04${RESET} (Ubuntu 20.04 LTS)"
@echo -e "\t\t${BOLD}opensuse-leap${RESET} (latest)"
@echo -e "\t\t${BOLD}rockylinux-9${RESET} (latest)"
@echo
@echo -e "\t${BOLD}<stage>${RESET}:"
@echo -e "\t\t${BOLD}env${RESET}"
Expand All @@ -126,6 +128,8 @@ help:
@echo -e "\te.g. 'make amd64_ubuntu-22.04_cpp_test'"
@echo
@echo -e "\tnote: Few custom merge targets (e.g. ${BOLD}export${RESET}) are also provided."
@echo -e "\te.g. 'make amd64_almalinux-9_export'"
@echo -e "\te.g. 'make arm64_almalinux-9_export'"
@echo
@echo -e "\t${BOLD}NOCACHE=1${RESET}: use 'docker build --no-cache' when building container (default use cache)."
@echo
Expand Down Expand Up @@ -399,12 +403,14 @@ PLATFORMS := amd64 arm64 # riscv64

# Currently supported distro
DISTROS := \
almalinux-9 \
alpine-edge \
archlinux \
debian-11 debian-12 debian-sid \
fedora-37 fedora-38 fedora-39 \
ubuntu-20.04 ubuntu-22.04 ubuntu-23.04 ubuntu-23.10 ubuntu-24.04 \
opensuse-leap \
rockylinux-9

# List of stages
STAGES := env devel
Expand Down
116 changes: 116 additions & 0 deletions tools/docker/images/almalinux-9.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# ref: https://hub.docker.com/_/almalinux
FROM almalinux:9 AS env

#############
## SETUP ##
#############
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]

# Install SWIG 4.2.1
FROM base AS swig
RUN dnf -y update \
&& dnf -y install pcre2-devel \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \
&& tar xvf swig-4.2.1.tar.gz \
&& rm swig-4.2.1.tar.gz \
&& cd swig-4.2.1 \
&& ./configure --prefix=/usr \
&& make -j 4 \
&& make install \
&& cd .. \
&& rm -rf swig-4.2.1

# Install .Net
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

# Java Install
RUN dnf -y update \
&& dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \
&& dnf clean all \
&& rm -rf /var/cache/dnf

# Install Python
RUN dnf -y update \
&& dnf -y install python3-devel python3-pip python3-numpy \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN python3 -m pip install \
absl-py mypy mypy-protobuf pandas

################
## OR-TOOLS ##
################
FROM env AS devel
ENV DISTRIBUTION=almalinux-9

WORKDIR /root
# 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:-main}
ARG SRC_GIT_SHA1
ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown}

ARG OR_TOOLS_PATCH
ENV OR_TOOLS_PATCH ${OR_TOOLS_PATCH:-9999}

# Download sources
# use SRC_GIT_SHA1 to modify the command
# i.e. avoid docker reusing the cache when new commit is pushed
SHELL ["/bin/bash", "-c"]
RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch --depth=1 https://github.com/google/or-tools \
&& [[ $(cd or-tools && git rev-parse --verify HEAD) == ${SRC_GIT_SHA1} ]]
WORKDIR /root/or-tools

# C++
## build
FROM devel AS cpp_build
RUN make detect_cpp \
&& make cpp JOBS=8
## archive
FROM cpp_build AS cpp_archive
RUN make archive_cpp

# .Net
## build
FROM cpp_build AS dotnet_build
ENV USE_DOTNET_CORE_31=ON
RUN make detect_dotnet \
&& make dotnet JOBS=8
## archive
FROM dotnet_build AS dotnet_archive
RUN make archive_dotnet

# Java
## build
FROM cpp_build AS java_build
RUN make detect_java \
&& make java JOBS=8
## archive
FROM java_build AS java_archive
RUN make archive_java

# Python
## build
FROM cpp_build AS python_build
RUN make detect_python \
&& make python JOBS=8
## archive
FROM python_build AS python_archive
RUN make archive_python
116 changes: 116 additions & 0 deletions tools/docker/images/rockylinux-9.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# ref: https://hub.docker.com/_/rockylinux
FROM rockylinux:9 AS env

#############
## SETUP ##
#############
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]

# Install SWIG 4.2.1
FROM base AS swig
RUN dnf -y update \
&& dnf -y install pcre2-devel \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \
&& tar xvf swig-4.2.1.tar.gz \
&& rm swig-4.2.1.tar.gz \
&& cd swig-4.2.1 \
&& ./configure --prefix=/usr \
&& make -j 4 \
&& make install \
&& cd .. \
&& rm -rf swig-4.2.1

# Install .Net
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

# Java Install
RUN dnf -y update \
&& dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \
&& dnf clean all \
&& rm -rf /var/cache/dnf

# Install Python
RUN dnf -y update \
&& dnf -y install python3-devel python3-pip python3-numpy \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN python3 -m pip install \
absl-py mypy mypy-protobuf pandas

################
## OR-TOOLS ##
################
FROM env AS devel
ENV DISTRIBUTION=rockylinux-9

WORKDIR /root
# 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:-main}
ARG SRC_GIT_SHA1
ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown}

ARG OR_TOOLS_PATCH
ENV OR_TOOLS_PATCH ${OR_TOOLS_PATCH:-9999}

# Download sources
# use SRC_GIT_SHA1 to modify the command
# i.e. avoid docker reusing the cache when new commit is pushed
SHELL ["/bin/bash", "-c"]
RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch --depth=1 https://github.com/google/or-tools \
&& [[ $(cd or-tools && git rev-parse --verify HEAD) == ${SRC_GIT_SHA1} ]]
WORKDIR /root/or-tools

# C++
## build
FROM devel AS cpp_build
RUN make detect_cpp \
&& make cpp JOBS=8
## archive
FROM cpp_build AS cpp_archive
RUN make archive_cpp

# .Net
## build
FROM cpp_build AS dotnet_build
ENV USE_DOTNET_CORE_31=ON
RUN make detect_dotnet \
&& make dotnet JOBS=8
## archive
FROM dotnet_build AS dotnet_archive
RUN make archive_dotnet

# Java
## build
FROM cpp_build AS java_build
RUN make detect_java \
&& make java JOBS=8
## archive
FROM java_build AS java_archive
RUN make archive_java

# Python
## build
FROM cpp_build AS python_build
RUN make detect_python \
&& make python JOBS=8
## archive
FROM python_build AS python_archive
RUN make archive_python
18 changes: 18 additions & 0 deletions tools/docker/test/almalinux-9/cpp.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ref: https://hub.docker.com/_/almalinux
FROM almalinux:9

#############
## SETUP ##
#############
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]

WORKDIR /root
ADD or-tools_amd64_almalinux-9_cpp_v*.tar.gz .

RUN cd or-tools_*_v* && make test
27 changes: 27 additions & 0 deletions tools/docker/test/almalinux-9/dotnet.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ref: https://hub.docker.com/_/almalinux
FROM almalinux:9

#############
## SETUP ##
#############
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]

# Install .Net
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

WORKDIR /root
ADD or-tools_amd64_almalinux-9_dotnet_v*.tar.gz .

RUN cd or-tools_*_v* && make test
24 changes: 24 additions & 0 deletions tools/docker/test/almalinux-9/java.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ref: https://hub.docker.com/_/almalinux
FROM almalinux:9

#############
## SETUP ##
#############
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]

# Install Java 8 SDK
RUN dnf -y update \
&& dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \
&& dnf clean all \
&& rm -rf /var/cache/dnf

WORKDIR /root
ADD or-tools_amd64_almalinux-9_java_v*.tar.gz .

RUN cd or-tools_*_v* && make test
26 changes: 26 additions & 0 deletions tools/docker/test/almalinux-9/python.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ref: https://hub.docker.com/_/almalinux
FROM almalinux:9

#############
## SETUP ##
#############
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]

# Install Python
RUN dnf -y update \
&& dnf -y install python3-devel python3-pip python3-numpy \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN python3 -m pip install \
absl-py mypy mypy-protobuf pandas

WORKDIR /root
ADD or-tools_amd64_almalinux-9_python_v*.tar.gz .

RUN cd or-tools_*_v* && make test

0 comments on commit c0c54fb

Please sign in to comment.