2022-03-25 10:10:14 +00:00
|
|
|
pipeline:
|
2022-03-27 18:24:53 +00:00
|
|
|
generate_docker_tag:
|
2022-03-25 11:21:26 +00:00
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- echo -n "${CI_COMMIT_BRANCH//\//-}-${CI_COMMIT_SHA:0:8}, latest" > .tags
|
2022-03-27 18:24:53 +00:00
|
|
|
when:
|
|
|
|
event: push
|
|
|
|
|
|
|
|
generate_docker_tag_pr:
|
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- echo -n "pr-${CI_COMMIT_SHA:0:8}, pr" > .tags
|
|
|
|
when:
|
|
|
|
event: pull_request
|
|
|
|
|
|
|
|
# -------------------------------------- API --------------------------------------
|
2022-03-30 09:18:03 +00:00
|
|
|
test_api:
|
|
|
|
image: python
|
2022-04-04 13:07:29 +00:00
|
|
|
detach: true
|
2022-03-30 09:18:03 +00:00
|
|
|
commands:
|
2022-04-04 12:16:56 +00:00
|
|
|
- export MYSQL_USER=aktienbot
|
|
|
|
- export MYSQL_PASSWORD=12345678
|
|
|
|
- export MYSQL_HOST=mariadb
|
|
|
|
- export MYSQL_PORT=3306
|
2022-03-30 09:18:03 +00:00
|
|
|
- cd api/
|
|
|
|
- pip install -r requirements.txt
|
|
|
|
- python -m pytest
|
|
|
|
when:
|
|
|
|
path: "api/*"
|
|
|
|
event: push
|
|
|
|
|
2022-03-25 11:21:26 +00:00
|
|
|
build_api:
|
|
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
|
|
settings:
|
|
|
|
repo:
|
|
|
|
from_secret: repo_api
|
|
|
|
username:
|
|
|
|
from_secret: username
|
|
|
|
password:
|
|
|
|
from_secret: password
|
|
|
|
registry:
|
|
|
|
from_secret: registry
|
|
|
|
dockerfile: api/Dockerfile
|
|
|
|
platforms: linux/amd64
|
2022-03-27 08:08:43 +00:00
|
|
|
when:
|
|
|
|
path: "api/*"
|
2022-03-27 18:24:53 +00:00
|
|
|
event: push
|
2022-03-27 08:08:43 +00:00
|
|
|
|
|
|
|
deploy_api:
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
network_mode: host
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: ssh_host
|
|
|
|
username:
|
|
|
|
from_secret: ssh_user
|
|
|
|
password:
|
|
|
|
from_secret: ssh_password
|
|
|
|
script:
|
|
|
|
- /opt/docker/TelegramAktienBot/deploy_api.sh
|
|
|
|
when:
|
|
|
|
path: "api/*"
|
2022-03-27 18:24:53 +00:00
|
|
|
event: push
|
|
|
|
|
2022-03-25 10:20:35 +00:00
|
|
|
|
2022-03-27 18:24:53 +00:00
|
|
|
# -------------------------------------- Bot --------------------------------------
|
2022-03-25 11:21:26 +00:00
|
|
|
build_bot:
|
|
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
|
|
settings:
|
|
|
|
repo:
|
|
|
|
from_secret: repo_bot
|
|
|
|
username:
|
|
|
|
from_secret: username
|
|
|
|
password:
|
|
|
|
from_secret: password
|
|
|
|
registry:
|
|
|
|
from_secret: registry
|
|
|
|
dockerfile: telegram_bot/Dockerfile
|
|
|
|
platforms: linux/amd64
|
2022-03-27 08:08:43 +00:00
|
|
|
when:
|
|
|
|
path: "telegram_bot/*"
|
|
|
|
|
|
|
|
deploy_bot:
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
network_mode: host
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: ssh_host
|
|
|
|
username:
|
|
|
|
from_secret: ssh_user
|
|
|
|
password:
|
|
|
|
from_secret: ssh_password
|
|
|
|
script:
|
|
|
|
- /opt/docker/TelegramAktienBot/deploy_bot.sh
|
|
|
|
when:
|
|
|
|
path: "telegram_bot/*"
|
|
|
|
|
2022-03-27 18:24:53 +00:00
|
|
|
|
|
|
|
# -------------------------------------- Frontend --------------------------------------
|
2022-03-25 11:21:26 +00:00
|
|
|
build_frontend:
|
|
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
|
|
settings:
|
|
|
|
repo:
|
|
|
|
from_secret: repo_frontend
|
|
|
|
username:
|
|
|
|
from_secret: username
|
|
|
|
password:
|
|
|
|
from_secret: password
|
|
|
|
registry:
|
|
|
|
from_secret: registry
|
|
|
|
dockerfile: frontend/Dockerfile
|
|
|
|
platforms: linux/amd64
|
2022-03-27 08:08:43 +00:00
|
|
|
when:
|
|
|
|
path: "frontend/*"
|
2022-03-25 11:05:30 +00:00
|
|
|
|
2022-03-27 08:08:43 +00:00
|
|
|
deploy_frontend:
|
2022-03-25 11:09:57 +00:00
|
|
|
image: appleboy/drone-ssh
|
|
|
|
network_mode: host
|
2022-03-25 11:20:56 +00:00
|
|
|
settings:
|
2022-03-25 11:18:40 +00:00
|
|
|
host:
|
2022-03-25 11:09:57 +00:00
|
|
|
from_secret: ssh_host
|
2022-03-25 11:18:40 +00:00
|
|
|
username:
|
2022-03-25 11:09:57 +00:00
|
|
|
from_secret: ssh_user
|
2022-03-25 11:18:40 +00:00
|
|
|
password:
|
2022-03-25 11:09:57 +00:00
|
|
|
from_secret: ssh_password
|
2022-03-25 11:20:56 +00:00
|
|
|
script:
|
2022-03-27 08:08:43 +00:00
|
|
|
- /opt/docker/TelegramAktienBot/deploy_frontend.sh
|
|
|
|
when:
|
|
|
|
path: "frontend/*"
|
2022-03-27 18:04:51 +00:00
|
|
|
|
2022-03-25 11:09:57 +00:00
|
|
|
branches: main
|