62 lines
2.0 KiB
Docker
62 lines
2.0 KiB
Docker
# 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
|
|
|
|
# SWIG
|
|
RUN apk add --no-cache swig
|
|
# Python
|
|
RUN apk add --no-cache python3-dev py3-pip py3-wheel
|
|
# Java
|
|
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
|
|
RUN apk add --no-cache openjdk8 maven
|
|
# .NET install
|
|
RUN apk add --no-cache wget icu-libs libintl
|
|
RUN dotnet_sdk_version=3.1.101 \
|
|
&& wget -O dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-musl-x64.tar.gz \
|
|
&& dotnet_sha512='ce386da8bc07033957fd404909fc230e8ab9e29929675478b90f400a1838223379595a4459056c6c2251ab5c722f80858b9ca536db1a2f6d1670a97094d0fe55' \
|
|
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
|
|
&& mkdir -p /usr/share/dotnet \
|
|
&& tar -C /usr/share/dotnet -oxzf dotnet.tar.gz \
|
|
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
|
|
&& rm dotnet.tar.gz
|
|
# Trigger first run experience by running arbitrary cmd
|
|
RUN dotnet --info
|
|
|
|
CMD [ "/bin/sh" ]
|
|
|
|
################
|
|
## 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
|