radiator-web/.gitlab-ci.yml

54 lines
1.2 KiB
YAML
Raw Normal View History

2021-04-04 15:35:36 +02:00
stages:
- build
- deploy
variables:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
ANSIBLE_PYTHON_INTERPRETER: auto_silent
ANSIBLE_STDOUT_CALLBACK: debug
2021-04-04 17:37:50 +02:00
docker-build-main:
2021-04-04 15:35:36 +02:00
# Official docker image.
image: docker:latest
stage: build
tags:
- docker
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
2021-04-04 17:37:50 +02:00
- main
2021-04-04 15:35:36 +02:00
docker-build:
# Official docker image.
image: docker:latest
stage: build
tags:
- docker
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- main
2021-04-04 17:37:50 +02:00
deploy-main:
2021-04-04 15:35:36 +02:00
#when: manual
stage: deploy
image:
name: cytopia/ansible:latest-tools
entrypoint: [""]
script:
- chmod 600 "${ANSIBLE_SSH_KEY_PRIVATE}"
- ansible-playbook -i ./deployment/hosts.yml --private-key "${ANSIBLE_SSH_KEY_PRIVATE}" "./deployment/deployment.yml"
only:
- main