ci: add building and deploying

This commit is contained in:
Dmitriy Pleshevskiy 2022-06-08 23:22:22 +03:00
parent d501fb900c
commit aa9c656a3b
Signed by: pleshevskiy
GPG Key ID: 1B59187B161C0215
2 changed files with 79 additions and 0 deletions

49
.drone.yml Normal file
View File

@ -0,0 +1,49 @@
kind: pipeline
type: docker
name: default
trigger:
branch:
- main
event:
- push
steps:
- name: build-docker-image
image: plugins/docker
settings:
username:
from_secret: org_registry_username
password:
from_secret: org_registry_password
registry: ${ORG_REGISTRY}
repo: ${ORG_REGISTRY}/${DRONE_REPO}
tags:
- ${DRONE_COMMIT_SHA:0:8}
- ${DRONE_TARGET_BRANCH}
- name: deploy
when:
status:
- success
image: registry.pleshevski.ru/drone_plugins/docker_stack
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
PLESHEVSKI_IMAGE: ${ORG_REGISTRY}/${DRONE_REPO}:${DRONE_COMMIT_SHA:0:8}
settings:
username:
from_secret: org_registry_username
password:
from_secret: org_registry_password
name: 'pleshevski'
image_pull_secrets:
- org_docker_config
volumes:
- name: dockersock
host:
path: /var/run/docker.sock

30
docker-compose.yml Normal file
View File

@ -0,0 +1,30 @@
version: "3.9"
networks:
rp_public:
external: true
services:
site:
image: $PLESHEVSKI_IMAGE
networks:
- rp_public
deploy:
replicas: 1
endpoint_mode: vip
update_config:
order: start-first
rollback_config:
order: start-first
labels:
- traefik.enable=true
- traefik.docker.network=rp_public
- traefik.constraint-label=rp_public
- traefik.http.routers.pleshevski_http.rule=Host(`pleshevski.ru`)
- traefik.http.routers.pleshevski_http.entrypoints=http
- traefik.http.routers.pleshevski_http.middlewares=https_redirect
- traefik.http.routers.pleshevski_https.rule=Host(`pleshevski.ru`)
- traefik.http.routers.pleshevski_https.entrypoints=https
- traefik.http.routers.pleshevski_https.tls=true
- traefik.http.routers.pleshevski_https.tls.certresolver=le
- traefik.http.services.pleshevski.loadbalancer.server.port=33334