From ccf1f43df14972dbfedd1f9461eae68d797f1b69 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 10 Dec 2024 17:01:30 +0100 Subject: [PATCH] Publish Dockerfile in docker hub --- .github/workflows/on_tag.yml | 27 +++++++++++++++++++++++++-- .gitlab-ci.yml | 2 +- Dockerfile | 30 +++++++++++------------------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/on_tag.yml b/.github/workflows/on_tag.yml index a74099e..56d4fca 100644 --- a/.github/workflows/on_tag.yml +++ b/.github/workflows/on_tag.yml @@ -1,4 +1,4 @@ -name: Publish sdist tarball to PyPi +name: Publish sdist tarball to PyPi and docker image to docker hub on: push: @@ -15,7 +15,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.9 - - name: Build a source tarball + - name: Install build run: | python -m pip install --upgrade pip python -m pip install build @@ -27,3 +27,26 @@ jobs: with: password: ${{ secrets.PYPI_API_TOKEN }} verbose: true + + deploy_docker_image: + env: + CI_REGISTRY_IMAGE: bluebrain/bbp-atlas-pipeline + REGISTRY_IMAGE_TAG: ${{ github.ref_name }} + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Docker Hub Login + uses: docker/login-action@v3 + with: + username: ${{ vars.BBPBUILDBOT_DOCKERHUB_USER }} + password: ${{ secrets.BBPBUILDBOT_DOCKERHUB_PASSWORD }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ env.CI_REGISTRY_IMAGE }}:${{ env.REGISTRY_IMAGE_TAG }} + build-args: | + REF_NAME=${{ env.REGISTRY_IMAGE_TAG }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 692889b..b8cfb53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -171,7 +171,7 @@ update-pipeline-image: allow_failure: true variables: BUILD_PATH: $CI_PROJECT_DIR - KANIKO_EXTRA_ARGS: "--build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg BBP_CA_CERT='$BBP_CA_CERT'" + KANIKO_EXTRA_ARGS: "--build-arg REF_NAME=$REGISTRY_IMAGE_TAG" KUBERNETES_MEMORY_LIMIT: 4Gi KUBERNETES_MEMORY_REQUEST: 4Gi before_script: diff --git a/Dockerfile b/Dockerfile index 7a03596..1e13da3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM python:3.10-slim -ARG CI_JOB_TOKEN -ARG BBP_CA_CERT +ARG REF_NAME=main # Default to 'main' if REF_NAME is not passed RUN apt-get update && \ DEBIAN_FRONTEND="noninteractive" TZ="Europe/Zurich" apt-get install -y tzdata && \ @@ -27,39 +26,32 @@ COPY .. . # export PATH=$PATH:$PWD/build/bin # Install the pipeline repository (along with the bbp-atlas CLI) -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ blue_brain_atlas_pipeline/ +RUN pip install git+https://github.com/BlueBrain/bbp-atlas-pipeline.git@${REF_NAME} -# For install dependencies -RUN git config --global --add url."https://gitlab-ci-token:${CI_JOB_TOKEN}@bbpgitlab.epfl.ch/".insteadOf https://bbpgitlab.epfl.ch/ +# Install dependencies # module load py-token-fetch -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "blue-brain-token-fetch>=1.0.0" +RUN pip install "blue-brain-token-fetch>=1.0.0" # module load py-bba-datafetch -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "bba-data-fetch>=0.3.0" +RUN pip install git+https://github.com/BlueBrain/bbp-atlas-data-fetch.git@v0.3.0 # densities validation -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "densities-validation>=0.1.1" +RUN pip install git+https://github.com/BlueBrain/molsys-cell-atlas.git@v1.0.0 # leaves-only -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "cell-densities>=0.2.1" +RUN git clone --branch v0.2.1 https://github.com/BlueBrain/cell-density-validations.git cell-density-validation +RUN pip install cell-density-validation/cell-densities/ # module load py-bba-webexporter -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "blue-brain-atlas-web-exporter>=3.0.0" - -# module load py-data-integrity-check -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "bba-data-integrity-check>=0.2.0" +RUN pip install git+https://github.com/BlueBrain/bbp-atlas-web-exporter.git@v3.0.0 RUN pip install blue-cwl # module load py-bba-data-push -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "bba-data-push>=4.3.0" - -RUN pip install git+https://bbpgitlab.epfl.ch/dke/users/jonathanlurie/atlas_cell_transplant.git@v0.3.1 - -RUN pip install -i https://bbpteam.epfl.ch/repository/devpi/simple/ "pipeline-validator>=0.3.1" +RUN pip install "blue-brain-data-push>=4.3.0" -RUN git config --global --remove-section url."https://gitlab-ci-token:${CI_JOB_TOKEN}@bbpgitlab.epfl.ch/" +RUN pip install "bbp-atlas-pipeline-validator>=0.3.1" RUN pip install "atlas-commons>=0.1.5"