52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
when:
|
|
- event: [push]
|
|
|
|
steps:
|
|
test:
|
|
image: python:3.11-slim
|
|
commands:
|
|
- pip install --no-cache-dir -r requirements.txt
|
|
- pytest -q
|
|
|
|
docker_build_push:
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
settings:
|
|
registry: ${CI_REGISTRY}
|
|
repo: ${CI_REGISTRY_IMAGE}
|
|
username:
|
|
from_secret: registry_user
|
|
password:
|
|
from_secret: registry_password
|
|
dockerfile: Dockerfile
|
|
platforms: linux/amd64
|
|
tags:
|
|
- ${CI_COMMIT_SHA}
|
|
- stable
|
|
when:
|
|
- branch: [main, master]
|
|
|
|
deploy_pull_on_host:
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: deploy_host
|
|
username:
|
|
from_secret: deploy_user
|
|
key:
|
|
from_secret: deploy_ssh_key
|
|
port:
|
|
from_secret: deploy_port
|
|
script:
|
|
- docker login ${CI_REGISTRY} -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD}
|
|
- docker pull ${CI_REGISTRY_IMAGE}:stable
|
|
- docker rm -f max-support-bot || true
|
|
- docker run -d --name max-support-bot --restart unless-stopped -p 8000:8000 --env-file /opt/max-support/.env -v /opt/max-support/data:/app/data ${CI_REGISTRY_IMAGE}:stable
|
|
- curl -fsS http://127.0.0.1:8000/health
|
|
environment:
|
|
REGISTRY_USER:
|
|
from_secret: registry_user
|
|
REGISTRY_PASSWORD:
|
|
from_secret: registry_password
|
|
when:
|
|
- branch: [main, master]
|
|
|