dorie.dockerfile 1.31 KB
Newer Older
1
ARG BASE_IMG_VERSION=1.2
2
ARG DUNE_ENV_IMAGE=dorie/dune-env:img-v${BASE_IMG_VERSION}
3 4

# start build image
5
FROM ${DUNE_ENV_IMAGE} as build-env
6 7

# maintainer info
8
LABEL maintainer="lriedel@iup.uni-heidelberg.de"
9

10 11
# number of cores for parallel builds
ARG PROCNUM=1
12 13 14
# Compilers to be used
ARG CC=gcc
ARG CXX=g++
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29
# copy the build context to this image
WORKDIR /opt/dune/dorie
COPY ./ ./

# build the executable
WORKDIR /opt/dune/
RUN MAKE_FLAGS="-j${PROCNUM}" \
    CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX} -DDUNE_PYTHON_VIRTUALENV_SETUP=True -DDUNE_PYTHON_ALLOW_GET_PIP=True" \
    ./dune-common/bin/dunecontrol --only=dorie all

# Start a fresh image as production environment
FROM $DUNE_ENV_IMAGE as prod-env

# Copy binaries, Python venv, and Python scripts (editable install)
30
WORKDIR /opt/dune
31 32 33 34
COPY --from=build-env /opt/dune/dune-common/build-cmake/dune-env ./dune-common/build-cmake/dune-env
WORKDIR /opt/dune/dorie
COPY --from=build-env /opt/dune/dorie/build-cmake ./build-cmake/
COPY --from=build-env /opt/dune/dorie/python ./python/
35 36

# move to working directory
37
WORKDIR /mnt
38 39

# run bash in the virtualenv (this actually creates two bash instances...)
40
# TODO: create new user with restricted privileges
41
ENTRYPOINT ["/opt/dune/dune-common/build-cmake/run-in-dune-env", "/bin/bash"]