optimiser-solver/Dockerfile
Radosław Piliszek b37fe6858a [CI] Fix images jobs files
So that they are triggered again on any change to the repo contents
(due to the repo structure).

Also - unpin the dependencies' versions as old ones tend to
be deleted from Fedora repos.

Co-Authored-By: Jan Marchel <jmarchel@7bulls.com>
Change-Id: I3f99f96d1a411dd5518098ad20d6ab90ff5d89fe
2024-05-27 09:07:43 +00:00

85 lines
2.5 KiB
Docker

FROM fedora:39 AS builder
# To build:
# docker build -t nebulous/solver .
#
# For a shell, to diagnose problems etc.:
# docker run --rm -it --entrypoint /bin/bash nebulous/solver
RUN mkdir -p /solver
WORKDIR /solver
# Development framework, dependencies
RUN dnf --assumeyes update && dnf --assumeyes install \
gcc-c++ \
make \
git-core \
boost-devel \
ccache \
qpid-proton-cpp-devel \
json-c \
json-devel \
json-glib \
jsoncpp \
jsoncpp-devel \
coin-or-Couenne \
wget \
&& \
dnf clean all && \
git clone https://github.com/jarro2783/cxxopts.git CxxOpts && \
git clone https://github.com/GeirHo/TheronPlusPlus.git Theron++ && \
mkdir Theron++/Bin
# Install AMPL library
RUN wget --progress=dot:giga https://portal.ampl.com/external/?url=https://portal.ampl.com/dl/amplce/ampl.linux64.tgz -O ampl.linux64.tgz && \
tar --file=ampl.linux64.tgz --extract && \
mv ampl.linux-intel64 AMPL && \
rm ampl.linux64.tgz
# Make AMPL shared libraries findable
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/solver/AMPL:/solver/AMPL/amplapi/lib"
COPY . /solver
# Build solver
RUN make SolverComponent -e THERON=./Theron++ AMPL_INCLUDE=./AMPL/amplapi/include AMPL_LIB=./AMPL/amplapi/lib CxxOpts_DIR=./CxxOpts/include && \
make clean
# ============================================================
FROM fedora:39
WORKDIR /solver
RUN dnf --assumeyes update && dnf --assumeyes install \
boost \
qpid-proton-cpp \
json-c \
json-glib \
jsoncpp \
coin-or-Couenne \
&& \
dnf clean all
COPY --from=builder /solver /solver
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/solver/AMPL:/solver/AMPL/amplapi/lib"
# The `SolverComponent` arguments `--ModelDir` and `--AMPLDir` are
# constant, the other arguments can be given on the command line or
# via environment variables:
#
# -b amqbroker (variable ACTIVEMQ_HOST, default localhost)
# -P amqpport (variable ACTIVEMQ_PORT, default 5672)
# -u user (variable ACTIVEMQ_USER, default admin)
# -p amqppassword (variable ACTIVEMQ_PASSWORD)
# -e appid (variable APPLICATION_ID)
# -l license (variable AMPL_LICENSE)
#
# The docker can be started with explicit parameters, environment
# variables or a mix of both. Parameters override variables.
#
# docker run -e APPLICATION_ID="my_app_id" nebulous/solver -b="https://amqp.example.com/" -p=s3kr1t
#
RUN chmod +x /solver/start-solver.sh
ENTRYPOINT ["/solver/start-solver.sh"]