From 83329187f2758d69709e5928d570325bd2049aa6 Mon Sep 17 00:00:00 2001 From: Bastien Le Querrec <blq@laquadrature.net> Date: Sun, 10 Mar 2024 16:30:44 +0100 Subject: [PATCH] ci: compile une image par la CI --- .gitlab-ci.yml | 31 ++++++++++++++++++++++--------- Dockerfile | 10 ++++++++++ 2 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b894e93..e411c92 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,17 +1,32 @@ -image: debian:trixie - variables: DEBIAN_FRONTEND: noninteractive + IMAGE_NAME: $CI_REGISTRY_IMAGE/base stages: + - docker - install - test +docker: + stage: docker + tags: + - dind + variables: + DOCKER_DRIVER: "overlay2" + DOCKER_TLS_CERTDIR: "/certs" + services: + - docker:20.10.17-dind + before_script: + - docker info + - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} + script: + - docker build -t ${IMAGE_NAME}:latest . + - docker push ${IMAGE_NAME}:latest + image: docker:20.10.17 + install: stage: install - before_script: - - apt-get update && apt-get install --no-install-recommends -y python3 python3-virtualenv - - ln -s /usr/bin/python3 /usr/bin/python + image: ${IMAGE_NAME}:latest script: - virtualenv --python=/usr/bin/python3 . - source bin/activate @@ -25,14 +40,12 @@ install: test_ppparis: stage: test + image: ${IMAGE_NAME}:latest needs: [install] - before_script: - - apt-get update && apt-get install --no-install-recommends -y python3 python3-virtualenv chromium-driver make xauth xvfb tesseract-ocr tesseract-ocr-eng tesseract-ocr-fra ocrmypdf curl unzip - - ln -s /usr/bin/python3 /usr/bin/python + script: - curl --location --output artifacts.zip "${CI_SERVER_PROTOCOL}://${CI_SERVER_HOST}:${CI_SERVER_PORT}/api/v4/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_COMMIT_BRANCH}/download?job=${CI_JOB_NAME}&job_token=${CI_JOB_TOKEN}" || true - unzip artifacts.zip data/ppparis/* || true - rm artifacts.zip || true - script: - source bin/activate - python ./ppparis.py retry: 2 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..95efbb9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM debian:trixie + +ENV DEBIAN_FRONTEND="noninteractive" + +RUN apt-get update && \ + apt-get dist-upgrade -y && \ + apt-get install --no-install-recommends -y python3 python3-virtualenv chromium-driver make xauth xvfb tesseract-ocr tesseract-ocr-eng tesseract-ocr-fra ocrmypdf curl unzip && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists && \ + ln -s /usr/bin/python3 /usr/bin/python -- GitLab