dorie.dockerfile 1.27 KB
Newer Older
1 2 3 4 5 6
ARG BASE_IMG_VERSION=1.2

# start build image
FROM dorie/dune-env:img-v${BASE_IMG_VERSION} as build-env

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

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

15 16 17 18 19 20 21 22 23 24 25 26 27 28
# 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)
29
WORKDIR /opt/dune
30 31 32 33
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/
34 35

# move to working directory
36
WORKDIR /mnt
37 38

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