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.
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: