CI: Use podman & build-ah-engine instead of docker in docker

This commit is contained in:
saibotk 2020-06-30 05:16:57 +02:00
parent fea5eb37ca
commit a43f5bc329
No known key found for this signature in database
GPG key ID: A3299C587D5DF523

View file

@ -1,5 +1,7 @@
# Official docker image. # Pipeline for saiblog
image: quay.io/sheogorath/ubuntu-ci:18.04 # inspired by https://git.shivering-isles.com/shivering-isles/blog/-/blob/deploy/.gitlab-ci.yml
image: quay.io/sheogorath/build-ah-engine:latest
variables: variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
@ -13,7 +15,7 @@ stages:
spellcheck: spellcheck:
stage: orthography stage: orthography
image: node:10 image: docker.io/library/node:12.18.1
before_script: before_script:
- npm i -g markdown-spellcheck - npm i -g markdown-spellcheck
script: script:
@ -22,7 +24,7 @@ spellcheck:
- docker - docker
build: build:
image: docker.io/cibuilds/hugo image: docker.io/cibuilds/hugo:0.73
stage: build stage: build
variables: variables:
HUGO_ENV: production HUGO_ENV: production
@ -34,63 +36,49 @@ build:
artifacts: artifacts:
untracked: true untracked: true
paths: paths:
- public - public
expire_in: 1 week 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: package:
stage: package stage: package
services: image: quay.io/sheogorath/build-ah-engine:latest
- docker:dind
variables: variables:
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: ""
LANG: C.UTF-8 LANG: C.UTF-8
before_script: 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: script:
- docker build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - podman build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except: except:
- deploy - 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: test:
stage: test stage: test
services: image: quay.io/sheogorath/build-ah-engine:latest
- docker:dind
variables: variables:
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: ""
LANG: C.UTF-8 LANG: C.UTF-8
before_script: before_script:
- apt-get install curl - dnf install curl
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: 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 - sleep 5
- docker exec testing nginx -c /etc/nginx/nginx.conf -t - podman exec testing nginx -c /etc/nginx/nginx.conf -t
- curl http://docker/status.txt | grep -q 'OK' - curl http://localhost/status.txt | grep -q 'OK'
- docker stop testing - podman stop testing
- docker rm testing - podman rm testing
except: except:
- deploy - deploy
tags: tags:
@ -98,21 +86,18 @@ test:
test-deploy: test-deploy:
stage: test stage: test
services: image: quay.io/sheogorath/build-ah-engine:latest
- docker:dind
variables: variables:
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: ""
LANG: C.UTF-8 LANG: C.UTF-8
before_script: before_script:
- apt-get install curl - dnf install curl
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: 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 - sleep 5
- curl http://docker/status.txt | grep -q 'OK' - podman exec testing nginx -c /etc/nginx/nginx.conf -t
- docker stop testing - curl http://localhost/status.txt | grep -q 'OK'
- docker rm testing - podman stop testing
- podman rm testing
only: only:
- deploy - deploy
tags: tags: