From a43f5bc329b24cdf0af2e81ae740d1befbe82e4c Mon Sep 17 00:00:00 2001 From: saibotk Date: Tue, 30 Jun 2020 05:16:57 +0200 Subject: [PATCH] CI: Use podman & build-ah-engine instead of docker in docker --- .gitlab-ci.yml | 91 +++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84c429c..232a170 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,7 @@ -# Official docker image. -image: quay.io/sheogorath/ubuntu-ci:18.04 +# Pipeline for saiblog +# inspired by https://git.shivering-isles.com/shivering-isles/blog/-/blob/deploy/.gitlab-ci.yml + +image: quay.io/sheogorath/build-ah-engine:latest variables: GIT_SUBMODULE_STRATEGY: recursive @@ -13,7 +15,7 @@ stages: spellcheck: stage: orthography - image: node:10 + image: docker.io/library/node:12.18.1 before_script: - npm i -g markdown-spellcheck script: @@ -22,7 +24,7 @@ spellcheck: - docker build: - image: docker.io/cibuilds/hugo + image: docker.io/cibuilds/hugo:0.73 stage: build variables: HUGO_ENV: production @@ -34,63 +36,49 @@ build: artifacts: untracked: true paths: - - public + - public expire_in: 1 week -package-deploy: - stage: package - services: - - docker:19.03.1-dind - variables: - DOCKER_HOST: "tcp://docker:2375" - DOCKER_TLS_CERTDIR: "" - LANG: C.UTF-8 - before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - script: - - docker build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE" . - - docker push "$CI_REGISTRY_IMAGE" - only: - - deploy - tags: - - docker - package: stage: package - services: - - docker:dind + image: quay.io/sheogorath/build-ah-engine:latest variables: - DOCKER_HOST: "tcp://docker:2375" - DOCKER_TLS_CERTDIR: "" LANG: C.UTF-8 before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - - docker build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + - podman build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . + - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" except: - deploy - tags: - - docker + +package-deploy: + stage: package + image: quay.io/sheogorath/build-ah-engine:latest + variables: + LANG: C.UTF-8 + before_script: + - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - podman build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE" . + - podman push "$CI_REGISTRY_IMAGE" + only: + - deploy test: stage: test - services: - - docker:dind + image: quay.io/sheogorath/build-ah-engine:latest variables: - DOCKER_HOST: "tcp://docker:2375" - DOCKER_TLS_CERTDIR: "" LANG: C.UTF-8 before_script: - - apt-get install curl - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - dnf install curl script: - - docker run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + - podman run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - sleep 5 - - docker exec testing nginx -c /etc/nginx/nginx.conf -t - - curl http://docker/status.txt | grep -q 'OK' - - docker stop testing - - docker rm testing + - podman exec testing nginx -c /etc/nginx/nginx.conf -t + - curl http://localhost/status.txt | grep -q 'OK' + - podman stop testing + - podman rm testing except: - deploy tags: @@ -98,21 +86,18 @@ test: test-deploy: stage: test - services: - - docker:dind + image: quay.io/sheogorath/build-ah-engine:latest variables: - DOCKER_HOST: "tcp://docker:2375" - DOCKER_TLS_CERTDIR: "" LANG: C.UTF-8 before_script: - - apt-get install curl - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - dnf install curl script: - - docker run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE + - podman run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE:latest - sleep 5 - - curl http://docker/status.txt | grep -q 'OK' - - docker stop testing - - docker rm testing + - podman exec testing nginx -c /etc/nginx/nginx.conf -t + - curl http://localhost/status.txt | grep -q 'OK' + - podman stop testing + - podman rm testing only: - deploy tags: