diff --git a/tools/docker/Makefile b/tools/docker/Makefile index b59e8d5249..b27002cb3a 100644 --- a/tools/docker/Makefile +++ b/tools/docker/Makefile @@ -77,6 +77,7 @@ help: @echo @echo -e "\t${BOLD}${RESET}:" @echo -e "\t\t${BOLD}alpine-edge${RESET} (latest)" + @echo -e "\t\t${BOLD}archlinux${RESET} (latest)" @echo -e "\t\t${BOLD}centos-8${RESET} (Centos Stream 8)" @echo -e "\t\t${BOLD}centos-7${RESET} (Centos 7 LTS)" @echo -e "\t\t${BOLD}debian-11${RESET} (bullseye, latest)" @@ -368,6 +369,7 @@ PLATFORMS := amd64 arm64 # riscv64 # Currently supported distro DISTROS := \ alpine-edge \ + archlinux \ centos-7 centos-8 \ debian-10 debian-11 \ fedora-33 fedora-34 fedora-35 fedora-36 \ diff --git a/tools/docker/images/archlinux.Dockerfile b/tools/docker/images/archlinux.Dockerfile new file mode 100644 index 0000000000..1ecd0f0b93 --- /dev/null +++ b/tools/docker/images/archlinux.Dockerfile @@ -0,0 +1,62 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/archlinux/ +FROM archlinux:latest AS env + +############# +## SETUP ## +############# +ENV PATH=/usr/local/bin:$PATH +RUN pacman -Syu --noconfirm git base-devel cmake +ENTRYPOINT ["/bin/bash", "-c"] +CMD [ "/bin/bash" ] + +# Install SWIG +RUN pacman -Syu --noconfirm swig + +# Install Python +RUN pacman -Syu --noconfirm python python-pip +RUN python -m pip install absl-py mypy-protobuf + +# Install Java +RUN pacman -Syu --noconfirm jdk-openjdk maven +ENV JAVA_HOME=/usr/lib/jvm/default + +# Install .NET +RUN pacman -Syu --noconfirm dotnet-sdk +# Trigger first run experience by running arbitrary cmd +RUN dotnet --info + +################ +## OR-TOOLS ## +################ +FROM env AS devel +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} + +# Download sources +# use SRC_GIT_SHA1 to modify the command +# i.e. avoid docker reusing the cache when new commit is pushed +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 build +WORKDIR /root/or-tools + +ARG BUILD_LANG +ENV BUILD_LANG ${BUILD_LANG:-cpp} + +RUN make detect_${BUILD_LANG} \ +&& make ${BUILD_LANG} JOBS=4 + +# Create archive +FROM build AS archive +RUN make archive_${BUILD_LANG} diff --git a/tools/docker/test/archlinux/cpp.Dockerfile b/tools/docker/test/archlinux/cpp.Dockerfile new file mode 100644 index 0000000000..d990d04611 --- /dev/null +++ b/tools/docker/test/archlinux/cpp.Dockerfile @@ -0,0 +1,12 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/alpine +FROM alpine:edge AS env +LABEL maintainer="corentinl@google.com" +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN apk add --no-cache git build-base linux-headers cmake xfce4-dev-tools + +WORKDIR /root +ADD or-tools_amd64_alpine-edge_v*.tar.gz . + +RUN cd or-tools_*_v* && make test_cc diff --git a/tools/docker/test/archlinux/dotnet.Dockerfile b/tools/docker/test/archlinux/dotnet.Dockerfile new file mode 100644 index 0000000000..41fe856676 --- /dev/null +++ b/tools/docker/test/archlinux/dotnet.Dockerfile @@ -0,0 +1,37 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/alpine +FROM alpine:edge AS env +LABEL maintainer="corentinl@google.com" +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN apk add --no-cache git build-base linux-headers cmake xfce4-dev-tools + +# .NET install +RUN apk add --no-cache wget icu-libs libintl \ +&& mkdir -p /usr/share/dotnet \ +&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet + +# see: https://dotnet.microsoft.com/download/dotnet-core/3.1 +RUN dotnet_sdk_version=3.1.413 \ +&& wget -qO dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-musl-x64.tar.gz \ +&& dotnet_sha512='46ffb31754b295cdb7dc615d5f905aa5842e3ada0e3f975217dfecbaa94e7b0190e86136fe9693d354b6ef88faa83e1c48496ffb1d644bd7ff437aeb48b9229c' \ +&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ +&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \ +&& rm dotnet.tar.gz +# Trigger first run experience by running arbitrary cmd +RUN dotnet --info + +# see: https://dotnet.microsoft.com/download/dotnet-core/5.0 +RUN dotnet_sdk_version=5.0.401 \ +&& wget -qO dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-musl-x64.tar.gz \ +&& dotnet_sha512='a2077f4d1c9da9c69453b771cd239bad27f62379402cc5e1c74a1f2a960fd55efc85cc15eafbac11f17ea975895ce107fab4bbfc49880a0a14791e8ac13ca2de' \ +&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ +&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \ +&& rm dotnet.tar.gz +# Trigger first run experience by running arbitrary cmd +RUN dotnet --info + +WORKDIR /root +ADD or-tools_amd64_alpine-edge_v*.tar.gz . + +RUN cd or-tools_*_v* && make test_dotnet diff --git a/tools/docker/test/archlinux/java.Dockerfile b/tools/docker/test/archlinux/java.Dockerfile new file mode 100644 index 0000000000..c8ff64d151 --- /dev/null +++ b/tools/docker/test/archlinux/java.Dockerfile @@ -0,0 +1,14 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/alpine +FROM alpine:edge AS env +LABEL maintainer="corentinl@google.com" +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN apk add --no-cache git build-base linux-headers cmake xfce4-dev-tools +ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk +RUN apk add --no-cache openjdk8 maven + +WORKDIR /root +ADD or-tools_amd64_alpine-edge_v*.tar.gz . + +RUN cd or-tools_*_v* && make test_java