frontpage/.drone.yml

99 lines
2.1 KiB
YAML
Raw Normal View History

2021-12-14 23:00:41 +01:00
kind: pipeline
type: docker
name: build
trigger:
event:
- push
steps:
- name: tag-commit-hash
image: alpine
commands:
- echo '${DRONE_COMMIT:0:8}' > .tags
- name: tag-dev
image: alpine
when:
branch:
- dev
commands:
- sed -i '$s/$/,dev/' .tags
- name: tag-latest
image: alpine
when:
branch:
- senpai
commands:
- sed -i '$s/$/,latest/' .tags
2022-10-08 13:44:38 +02:00
- name: submodules
image: alpine/git
commands:
- git submodule update --init --recursive
2021-12-14 23:00:41 +01:00
- name: build-image
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_token
2022-01-05 16:55:19 +01:00
registry:
from_secret: registry_host
repo:
from_secret: local_repo
insecure: true
2021-12-14 23:00:41 +01:00
---
kind: pipeline
type: ssh
name: deploy
depends_on:
- build
trigger:
branch:
2021-12-14 23:10:45 +01:00
- senpai
2021-12-14 23:00:41 +01:00
- dev
event:
- push
server:
host:
from_secret: ssh_host
user:
from_secret: ssh_user
ssh_key:
from_secret: ssh_key
steps:
- name: deploy-dev
when:
branch:
- dev
environment:
DOCKER_USER:
from_secret: docker_user
DOCKER_PASS:
from_secret: docker_token
2022-01-05 16:55:19 +01:00
REGISTRY_HOST:
from_secret: registry_host
IMAGE: c0ntroller.de:dev
2021-12-14 23:00:41 +01:00
commands:
2022-01-05 16:55:19 +01:00
#- docker login -u $${DOCKER_USER} -p $${DOCKER_PASS}
2021-12-14 23:00:41 +01:00
- docker-compose -p website-dev -f docker-compose.dev.yml rm -s -v -f
2022-01-05 16:55:19 +01:00
- docker rmi $${REGISTRY_HOST}/$${IMAGE} || true
2022-01-12 19:53:49 +01:00
- docker rmi localhost:5000/$${IMAGE} || true
2022-01-05 16:55:19 +01:00
- docker pull $${REGISTRY_HOST}/$${IMAGE}
2021-12-14 23:00:41 +01:00
- docker-compose -p website-dev -f docker-compose.dev.yml up --no-build -d
- name: deploy-stable
when:
branch:
2021-12-14 23:06:18 +01:00
- senpai
2021-12-14 23:00:41 +01:00
environment:
DOCKER_USER:
from_secret: docker_user
DOCKER_PASS:
from_secret: docker_token
2022-01-05 16:55:19 +01:00
REGISTRY_HOST:
from_secret: registry_host
IMAGE: c0ntroller.de:latest
2021-12-14 23:00:41 +01:00
commands:
2022-01-05 16:55:19 +01:00
#- docker login -u $${DOCKER_USER} -p $${DOCKER_PASS}
2021-12-14 23:00:41 +01:00
- docker-compose -p website -f docker-compose.stable.yml rm -s -v -f
2022-01-05 16:55:19 +01:00
- docker rmi $${REGISTRY_HOST}/$${IMAGE} || true
2022-01-12 19:53:49 +01:00
- docker rmi localhost:5000/$${IMAGE} || true
2022-01-05 16:55:19 +01:00
- docker pull $${REGISTRY_HOST}/$${IMAGE}
2021-12-14 23:00:41 +01:00
- docker-compose -p website -f docker-compose.stable.yml up --no-build -d