2020-01-08 11:11:30 +01:00
|
|
|
# Official docker image.
|
2020-01-08 11:28:25 +01:00
|
|
|
image: quay.io/sheogorath/ubuntu-ci:18.04
|
2020-01-08 11:01:52 +01:00
|
|
|
|
|
|
|
variables:
|
|
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
2020-01-08 10:49:54 +01:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- orthography
|
|
|
|
- build
|
|
|
|
- package
|
|
|
|
- test
|
|
|
|
#- deploy
|
|
|
|
|
|
|
|
spellcheck:
|
|
|
|
stage: orthography
|
|
|
|
image: node:10
|
|
|
|
before_script:
|
|
|
|
- npm i -g markdown-spellcheck
|
|
|
|
script:
|
|
|
|
- mdspell -r -n -a --en-gb "content/posts/*.md" "content/posts/*.markdown"
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
build:
|
|
|
|
image: docker.io/cibuilds/hugo
|
|
|
|
stage: build
|
|
|
|
variables:
|
|
|
|
HUGO_ENV: production
|
|
|
|
LANG: C.UTF-8
|
|
|
|
before_script:
|
|
|
|
- hugo --minify --enableGitInfo
|
|
|
|
script:
|
|
|
|
- htmlproofer ./public --allow-hash-href --check-html --empty-alt-ignore --disable-external
|
|
|
|
artifacts:
|
|
|
|
untracked: true
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
expire_in: 1 week
|
|
|
|
|
|
|
|
package-deploy:
|
|
|
|
stage: package
|
|
|
|
services:
|
2020-01-08 11:11:30 +01:00
|
|
|
- docker:19.03.1-dind
|
2020-01-08 10:49:54 +01:00
|
|
|
variables:
|
|
|
|
DOCKER_HOST: "tcp://docker:2375"
|
2020-01-08 11:11:30 +01:00
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2020-01-08 10:49:54 +01:00
|
|
|
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
|
|
|
|
variables:
|
|
|
|
DOCKER_HOST: "tcp://docker:2375"
|
2020-01-08 11:11:30 +01:00
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2020-01-08 10:49:54 +01:00
|
|
|
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:$CI_COMMIT_REF_SLUG" .
|
|
|
|
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
|
|
|
except:
|
|
|
|
- deploy
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
variables:
|
|
|
|
DOCKER_HOST: "tcp://docker:2375"
|
2020-01-08 11:40:46 +01:00
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2020-01-08 10:49:54 +01:00
|
|
|
LANG: C.UTF-8
|
|
|
|
before_script:
|
|
|
|
- apt-get install curl
|
2020-01-08 11:53:17 +01:00
|
|
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
2020-01-08 10:49:54 +01:00
|
|
|
script:
|
|
|
|
- docker 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
|
|
|
|
except:
|
|
|
|
- deploy
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
test-deploy:
|
|
|
|
stage: test
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
variables:
|
|
|
|
DOCKER_HOST: "tcp://docker:2375"
|
2020-01-08 11:40:46 +01:00
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2020-01-08 10:49:54 +01:00
|
|
|
LANG: C.UTF-8
|
|
|
|
before_script:
|
|
|
|
- apt-get install curl
|
2020-01-08 11:53:17 +01:00
|
|
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
2020-01-08 10:49:54 +01:00
|
|
|
script:
|
|
|
|
- docker run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE
|
|
|
|
- sleep 5
|
|
|
|
- curl http://docker/status.txt | grep -q 'OK'
|
|
|
|
- docker stop testing
|
|
|
|
- docker rm testing
|
|
|
|
only:
|
|
|
|
- deploy
|
|
|
|
tags:
|
|
|
|
- docker
|