79 lines
2.2 KiB
Docker
79 lines
2.2 KiB
Docker
FROM ubuntu:16.04 AS env
|
|
|
|
#############
|
|
## SETUP ##
|
|
#############
|
|
RUN apt update -qq \
|
|
&& apt install -yq \
|
|
git pkg-config wget make cmake autoconf libtool zlib1g-dev gawk g++ curl subversion \
|
|
lsb-release libpcre3-dev \
|
|
&& apt clean \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
# Swig Install
|
|
RUN curl --location-trusted \
|
|
--remote-name "https://downloads.sourceforge.net/project/swig/swig/swig-4.0.1/swig-4.0.1.tar.gz" \
|
|
-o swig-4.0.1.tar.gz \
|
|
&& tar xvf swig-4.0.1.tar.gz \
|
|
&& rm swig-4.0.1.tar.gz \
|
|
&& cd swig-4.0.1 \
|
|
&& ./configure --prefix=/usr \
|
|
&& make -j 4 \
|
|
&& make install \
|
|
&& cd .. \
|
|
&& rm -rf swig-4.0.1
|
|
|
|
# Java install
|
|
RUN apt-get update -qq \
|
|
&& apt-get install -yq openjdk-8-jdk \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
# Dotnet Install
|
|
# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1604
|
|
RUN apt-get update -qq \
|
|
&& apt-get install -yq apt-transport-https \
|
|
&& wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb \
|
|
&& dpkg -i packages-microsoft-prod.deb \
|
|
&& apt-get update -qq \
|
|
&& apt-get install -yq dotnet-sdk-3.1 \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
# 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
|