diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a3e4b9e472b46e8d569cfee9f6428500ce95363..2aea7cda21e5b0fc176cb189d98c60c87ab0520f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,8 @@ stages: TOOLCHAIN: gcc-8-17 DUNECI_OS: debian DUNECI_BASE_IMAGE: ${CI_REGISTRY}/docker/ci/debian:10 - DUNE_COPASI_BASE_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_BUILD_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_DEPLOY_IMAGE: debian:buster DEPLOY_LATEST: "true" .debian_clang: &debian_clang @@ -39,21 +40,24 @@ stages: TOOLCHAIN: clang-6-17 DUNECI_OS: debian DUNECI_BASE_IMAGE: ${CI_REGISTRY}/docker/ci/debian:10 - DUNE_COPASI_BASE_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_BUILD_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_DEPLOY_IMAGE: debian:buster .ubuntu_gcc: &ubuntu_gcc <<: *global_variables TOOLCHAIN: gcc-7-17 DUNECI_OS: ubuntu DUNECI_BASE_IMAGE: ${CI_REGISTRY}/docker/ci/ubuntu:18.04 - DUNE_COPASI_BASE_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_BUILD_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_DEPLOY_IMAGE: ubuntu:18.04 .ubuntu_clang: &ubuntu_clang <<: *global_variables TOOLCHAIN: clang-6-17 DUNECI_OS: ubuntu DUNECI_BASE_IMAGE: ${CI_REGISTRY}/docker/ci/ubuntu:18.04 - DUNE_COPASI_BASE_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_BUILD_IMAGE: ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${TOOLCHAIN}-${BASE_IMAGE_VERSION} + DUNE_COPASI_DEPLOY_IMAGE: ubuntu:18.04 .setup: &setup image: ${DOCKER_IMAGE} @@ -63,8 +67,8 @@ stages: - docker build -f docker/dependencies.dockerfile --build-arg BASE_IMAGE=${DUNECI_BASE_IMAGE} --build-arg TOOLCHAIN=${TOOLCHAIN} - -t ${DUNE_COPASI_BASE_IMAGE} . - - docker push ${DUNE_COPASI_BASE_IMAGE} + -t ${DUNE_COPASI_BUILD_IMAGE} . + - docker push ${DUNE_COPASI_BUILD_IMAGE} - docker logout $CI_REGISTRY/copasi/dune-copasi rules: - if: '$REBUILD_BASE_IMAGE' @@ -74,7 +78,7 @@ stages: <<: *dind_docker_tags .build: &build - image: ${DUNE_COPASI_BASE_IMAGE} + image: ${DUNE_COPASI_BUILD_IMAGE} stage: build script: - cd .. @@ -86,7 +90,7 @@ stages: <<: *default_tags .unit_tests: &unit_tests - image: ${DUNE_COPASI_BASE_IMAGE} + image: ${DUNE_COPASI_BUILD_IMAGE} stage: unit_tests script: - echo 'CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=Debug"' >> /duneci/cmake-flags/dune_copasi.opts @@ -100,7 +104,7 @@ stages: <<: *default_tags .system_tests: &system_tests - image: ${DUNE_COPASI_BASE_IMAGE} + image: ${DUNE_COPASI_BUILD_IMAGE} stage: system_tests script: - cd .. @@ -120,7 +124,8 @@ stages: - echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY/copasi/dune-copasi - DOCKER_TAG="${DUNECI_OS}-${TOOLCHAIN}-${CI_COMMIT_REF_NAME}" - docker build -f docker/dune-copasi.dockerfile - --build-arg BASE_IMAGE=${DUNE_COPASI_BASE_IMAGE} + --build-arg BUILD_IMAGE=${DUNE_COPASI_BUILD_IMAGE} + --build-arg PRODUCTION_IMAGE=${DUNE_COPASI_DEPLOY_IMAGE} --build-arg BRANCH=${CI_COMMIT_REF_NAME} -t $CI_REGISTRY/copasi/dune-copasi/dune-copasi:${DOCKER_TAG} . - docker push $CI_REGISTRY/copasi/dune-copasi/dune-copasi:${DOCKER_TAG} diff --git a/doc/docusaurus/docs/install_use.md b/doc/docusaurus/docs/install_use.md index b03bb1d3d89b576a2c244931b5b0668f66f2ff6d..b8c7846fe30ba577762fa801a11a4302d96bf09b 100644 --- a/doc/docusaurus/docs/install_use.md +++ b/doc/docusaurus/docs/install_use.md @@ -47,7 +47,7 @@ To run the `dune_copasi_md` executable from the container with a configuration file `config.ini`, execute the following command on the terminal: ```bash -docker run -v $PWD:/duneci/dune-copasi registry.dune-project.org/copasi/dune-copasi/dune-copasi:latest dune_copasi_md config.ini +docker run -v $PWD:/dunecopasi registry.dune-project.org/copasi/dune-copasi/dune-copasi:latest dune_copasi_md config.ini ``` The results of those computations will be written on current diff --git a/docker/dune-copasi.dockerfile b/docker/dune-copasi.dockerfile index 2bcf6ff937a2a849a74599447d450fe0c0dc455a..246c4a4b96ab9b488b6064a304f64e139318f593 100644 --- a/docker/dune-copasi.dockerfile +++ b/docker/dune-copasi.dockerfile @@ -1,12 +1,20 @@ -ARG BASE_IMAGE -FROM ${BASE_IMAGE} -ARG DUNECI_PARALLEL=2 +ARG BUILD_IMAGE +ARG PRODUCTION_IMAGE + +FROM ${BUILD_IMAGE} AS build-env + ARG BRANCH=master +ARG DUNECI_PARALLEL=2 RUN duneci-install-module -b ${BRANCH} https://gitlab.dune-project.org/copasi/dune-copasi.git RUN dunecontrol --only=dune-copasi bexec cmake --build . -- install -RUN mkdir /duneci/dune-copasi && rm -rf /duneci/modules/ -ENV PATH="${PATH}:/duneci/install/bin" -WORKDIR /duneci/dune-copasi -VOLUME ["/duneci/dune-copasi"] +FROM ${PRODUCTION_IMAGE} AS production-env +LABEL maintainer="santiago.ospina@iwr.uni-heidelberg.de" + +COPY --from=0 /duneci/install /usr/local +RUN adduser --disabled-password --home /dunecopasi --uid 50000 dunecopasi + +WORKDIR /dunecopasi +VOLUME ["/dunecopasi"] +USER dunecopasi