diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51e0f225ce743e4f12d4513d7e2dd972ef22788f..7e39f5818661168b75f0ea88fae56ff8b5a8c578 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -78,9 +78,25 @@ pages: stage: deploy dependencies: - test-pg + services: + - registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind script: - - mv ippisite/htmlcov public/ - - mv ippisite/docs/build/html/ public/ + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + # pull the latest build on this branch + - docker pull "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/web-container:latest" || true + # build the image while passing commit SHA and tagging the image with it + - cd ippisite + - docker build + --target docs-container + --build-arg CI_COMMIT_REF_SLUG + --build-arg CI_COMMIT_SHA + --cache-from "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/web-container:latest" + --tag ippidb_docs + . + - mkdir build/ + - docker run -v $(pwd)/build/:/code/docs/build/ ippidb_docs + - mv build/html/ ../public/ + - mv ../htmlcov ../public/ artifacts: paths: - public @@ -237,4 +253,4 @@ delete-dev-deployment: script: - echo "Removing $CI_COMMIT_REF_SLUG" - helm delete -n ${NAMESPACE} ${CI_COMMIT_REF_SLUG} - - kubectl delete pvc -n ${NAMESPACE} -lapp.kubernetes.io/instance=${CI_COMMIT_REF_SLUG} \ No newline at end of file + - kubectl delete pvc -n ${NAMESPACE} -lapp.kubernetes.io/instance=${CI_COMMIT_REF_SLUG} diff --git a/ippisite/.dockerignore b/ippisite/.dockerignore index 1260d5e15f2b0f74f3c74a2e2075be6658c8988e..a4ddbc3d1877351d4e84916d9a9b6d686062e445 100755 --- a/ippisite/.dockerignore +++ b/ippisite/.dockerignore @@ -9,6 +9,6 @@ ippidb.json ippidb.json.gz db.json db.sql.gz -db-django-4.0.sql.gz +db*.sql.gz persistent/media/* # END OF FILE \ No newline at end of file diff --git a/ippisite/Dockerfile b/ippisite/Dockerfile index dd3eee40250854ec205e7b28209cea7a80669eb2..84a8e92b83d2974cf54cd52a2f43bd93fb39ba24 100644 --- a/ippisite/Dockerfile +++ b/ippisite/Dockerfile @@ -1,7 +1,7 @@ ############################################################################### -# BAse image containing libs, dependencies and code +# Base image containing libs, dependencies ############################################################################### -FROM python:3.9 AS base-container +FROM python:3.9 AS base-container-without-sources EXPOSE 8000 ENV PYTHONPATH "${PYTHONPATH}:/usr/lib/python3/dist-packages" @@ -16,6 +16,7 @@ RUN addgroup --gid 1000 kiwi \ gettext \ python3-dev \ python3-openbabel \ + graphviz-dev \ && rm -rf /var/lib/apt/lists/* \ && python -m pip install --upgrade pip setuptools \ && mkdir /code @@ -28,8 +29,13 @@ RUN pip install -r requirements.txt COPY ./*-entrypoint.sh / RUN chmod a+x /*-entrypoint.sh -COPY . /code/ +############################################################################### +# Base image plus the sources +############################################################################### +FROM base-container-without-sources AS base-container + +COPY . /code/ ############################################################################### # django web app @@ -57,4 +63,22 @@ ENTRYPOINT ["/docker-celery-entrypoint.sh"] CMD ["celery", "-A", "ippisite", "worker", "-l", "info", "--concurrency", "2"] -USER kiwi \ No newline at end of file +USER kiwi + + +############################################################################### +# build the docs +############################################################################### +FROM base-container-without-sources AS docs-container + +ENV USE_SQLITE_AS_DB True + +COPY requirements*.txt /code/ +RUN pip install -r requirements-dev.txt \ + && mkdir -p /root/.config/bioservices + +CMD ["make", "html" ] + +COPY . /code/ + +WORKDIR /code/docs