stages: - build_and_run - release image: ${IMAGE} variables: BASEIMAGE: ${CI_REGISTRY}/${CURRENT_TEMPLATE_IMAGE} .install-nextflow: &install-nextflow | wget -qO- https://get.nextflow.io | bash .install-conda: &install-conda | wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh -b -p ./miniconda source ./miniconda/bin/activate conda init conda-run: image: ubuntu:20.04 stage: build_and_run before_script: - apt update && apt install -y wget default-jre - *install-nextflow - *install-conda script: - ./nextflow run workflow.nf -w ${OUTPUT}/workspace -profile conda --reads test_data/reads.fq.gz --out_dir ${OUTPUT} build-image: stage: build_and_run before_script: - apk add wget openjdk11 bash - *install-nextflow script: - echo ${CI_BUILD_TOKEN} | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY} - TAG="${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}" - docker build --no-cache -t "${TAG}" -f Dockerfile . --build-arg BASEIMAGE=${BASEIMAGE} # run letting nextflow orchestrate the containers - docker tag "${TAG}" "${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:latest" - OUTPUT="template-workflow" - ./nextflow run workflow.nf -w ${OUTPUT}/workspace -profile standard --reads test_data/reads.fq.gz --out_dir ${OUTPUT} # push - if [[ ${CI_COMMIT_BRANCH} == 'dev' ]]; then SHATAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}; echo "Pushing ${SHATAG}"; docker tag ${TAG} ${SHATAG}; docker push ${SHATAG}; fi; only: - branches artifacts: paths: # Add the output directory for the test - "template-workflow" expire_in: 1 day ### # Retag the image for git tags (releases) .pull_tag: &pull_tag before_script: - echo ${CI_BUILD_TOKEN} | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY} - SHATAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA} - echo "Pulling ${SHATAG}" - docker pull ${SHATAG} only: - tags # To ONT registry release-int: stage: release <<: *pull_tag script: - echo ${CI_BUILD_TOKEN} | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY} - RELTAG=${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} - echo "Pushing ${TAG}" - docker tag ${SHATAG} ${RELTAG} - docker push ${RELTAG} # To dockerhub release-hub: stage: release <<: *pull_tag script: - echo ${DOCKERHUB_TOKEN} | docker login --username epi2melabs --password-stdin - RELTAG="${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_TAG}" - echo "Pushing ${RELTAG}" - docker tag ${SHATAG} ${RELTAG} - docker push ${RELTAG}