Skip to content

Commit

Permalink
Make build available on arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
alain-andre committed Jan 17, 2023
1 parent eeb2281 commit 5ab33c4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ARCHITECTURE=arm64v8/
RUBY_VERSION=2.6
RUBY_VERSION=2.5
ORTOOLS_VERSION=v7.8 # select from https://github.com/google/or-tools/releases
20 changes: 1 addition & 19 deletions .github/actions/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,7 @@ fi

IMAGE_NAME=${REGISTRY}/mapotempo-ce/optimizer-ortools:${TAG}

case $ORTOOLS_VERSION in
'v7.1')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.1/or-tools_debian-9_v7.1.6720.tar.gz"
;;
'v7.4')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.4/or-tools_debian-9_v7.4.7247.tar.gz"
;;
'v7.5')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.5/or-tools_debian-10_v7.5.7466.tar.gz"
;;
'v7.8')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.8/or-tools_debian-10_v7.8.7959.tar.gz"
;;
*)
echo "Unknown OR-Tools version"
esac

echo "Download asset at ${ORTOOLS_URL}"
docker build --build-arg RUBY_VERSION="2.6" --build-arg ORTOOLS_URL=${ORTOOLS_URL} -f ./Dockerfile -t "${IMAGE_NAME}" .
docker build --build-arg RUBY_VERSION="2.5" --build-arg ORTOOLS_VERSION="${ORTOOLS_VERSION}" -f ./Dockerfile -t "${IMAGE_NAME}" .
docker run -d --name optimizer -t "${IMAGE_NAME}"
docker exec -i optimizer bash -c "LD_LIBRARY_PATH=/srv/or-tools/lib/ /srv/optimizer-ortools/tsp_simple -time_limit_in_ms 500 -intermediate_solutions -instance_file '/srv/optimizer-ortools/data/test_ortools_single_route_with_route_order' -solution_file '/tmp/optimize-or-tools-output'"

Expand Down
27 changes: 19 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,29 @@ ARG ARCHITECTURE

FROM ${ARCHITECTURE}ruby:${RUBY_VERSION}

ARG ORTOOLS_URL=${ORTOOLS_URL}
ARG ORTOOLS_VERSION=${ORTOOLS_VERSION}

LABEL maintainer="Mapotempo <tech@mapotempo.com>"

WORKDIR /srv/

RUN apt-get update > /dev/null && \
apt-get -y install git wget pkg-config build-essential cmake autoconf libtool zlib1g-dev lsb-release > /dev/null

ADD . /srv/or-tools

RUN wget -qO- $ORTOOLS_URL | tar xz --strip-components=1 -C /srv/or-tools
apt install -y git build-essential cmake swig lsb-release python3-pip autoconf libtool zlib1g-dev > /dev/null && \
git clone -b ${ORTOOLS_VERSION} https://github.com/google/or-tools /srv/or-tools

# tmp until ruby image have the good cmake version
RUN curl 'https://github.com/Kitware/CMake/releases/download/v3.15.7/cmake-3.15.7.tar.gz' -s -L -R -o cmake.tar.gz && \
tar -zxvf cmake.tar.gz && \
cd cmake-3.15.7 && \
./bootstrap && \
make && \
make install && \
cd .. && \
rm -R cmake-3.15.7 cmake.tar.gz

RUN cd /srv/or-tools && \
/usr/local/bin/cmake -S . -B build -DBUILD_DEPS=ON -DBUILD_PYTHON=ON && \
/usr/local/bin/cmake --build build --config Release --target install -v && \
cd .. && \
rm -R /srv/or-tools

ADD . /srv/optimizer-ortools

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ services:
<<: *app-args
context: .
dockerfile: Dockerfile
image: dev.example.com/mapotempo/optimizer-ortools
image: dev.example.com/mapotempo-ce/${ARCHITECTURE}optimizer-ortools:latest
tty: true

0 comments on commit 5ab33c4

Please sign in to comment.