ci: add Forgejo Actions CI/CD pipeline for build, push and prod deploy
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 7m3s

Mirrors the LichessStatTgWeb pipeline: build all 7 service images,
push to the Gitea registry, transfer to the prod host via docker
save/load (registry isn't reachable from the external VPS), and
redeploy with docker-compose.prod.yml.
This commit is contained in:
vrubelroman 2026-06-30 19:44:05 +00:00
parent 4d575059b0
commit ab703e4bd6
3 changed files with 211 additions and 0 deletions

View file

@ -0,0 +1,58 @@
name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: shell
steps:
- name: Clone repository
run: git clone --depth 1 "http://192.168.8.174:3000/${GITHUB_REPOSITORY}.git" .
env:
GIT_TERMINAL_PROMPT: '0'
- name: Ensure Docker CLI
run: |
apk add --no-cache docker-cli docker-cli-compose openssh-client || true
grep -q '^vrubel:' /etc/passwd || echo 'vrubel:x:1000:1000::/data:/bin/sh' >> /etc/passwd
- name: Setup .env for CI/CD
run: cp .env.example .env
- name: Build Docker images
run: docker-compose build
- name: Login to Gitea Container Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login http://192.168.8.174:3000 -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Push images to registry
run: |
docker push 192.168.8.174:3000/vrubel/video-bot:latest
docker push 192.168.8.174:3000/vrubel/video-admin-bot:latest
docker push 192.168.8.174:3000/vrubel/video-youtube:latest
docker push 192.168.8.174:3000/vrubel/video-instagram:latest
docker push 192.168.8.174:3000/vrubel/video-vk:latest
docker push 192.168.8.174:3000/vrubel/video-yapfiles:latest
docker push 192.168.8.174:3000/vrubel/video-tiktok:latest
- name: Transfer images to prod
run: |
docker save \
192.168.8.174:3000/vrubel/video-bot:latest \
192.168.8.174:3000/vrubel/video-admin-bot:latest \
192.168.8.174:3000/vrubel/video-youtube:latest \
192.168.8.174:3000/vrubel/video-instagram:latest \
192.168.8.174:3000/vrubel/video-vk:latest \
192.168.8.174:3000/vrubel/video-yapfiles:latest \
192.168.8.174:3000/vrubel/video-tiktok:latest \
| ssh -i /data/.ssh/id_ed25519 -o StrictHostKeyChecking=no root@130.17.6.76 docker load
- name: Deploy on prod host
run: |
cat docker-compose.prod.yml | ssh -i /data/.ssh/id_ed25519 -o StrictHostKeyChecking=no root@130.17.6.76 \
"cat > ~/services/videoDownloadTGbot/docker-compose.yml"
ssh -i /data/.ssh/id_ed25519 -o StrictHostKeyChecking=no root@130.17.6.76 \
"cd ~/services/videoDownloadTGbot && docker compose up -d --remove-orphans"

90
docker-compose.prod.yml Normal file
View file

@ -0,0 +1,90 @@
services:
bot:
image: 192.168.8.174:3000/vrubel/video-bot:latest
container_name: video_download_bot
restart: unless-stopped
env_file:
- .env
environment:
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- TELEGRAM_BOT_USERNAME=${TELEGRAM_BOT_USERNAME}
- YOUTUBE_DOWNLOADER_URL=${YOUTUBE_DOWNLOADER_URL}
- INSTAGRAM_DOWNLOADER_URL=${INSTAGRAM_DOWNLOADER_URL}
- VK_DOWNLOADER_URL=${VK_DOWNLOADER_URL}
- YAPFILES_DOWNLOADER_URL=${YAPFILES_DOWNLOADER_URL}
- TIKTOK_DOWNLOADER_URL=${TIKTOK_DOWNLOADER_URL}
- ADMIN_BOT_TOKEN=${ADMIN_BOT_TOKEN}
volumes:
- ./video:/app/video
- ./data:/app/data:Z
network_mode: host
command: python bot.py
admin_bot:
image: 192.168.8.174:3000/vrubel/video-admin-bot:latest
container_name: admin_bot
restart: unless-stopped
env_file:
- .env
environment:
- ADMIN_BOT_TOKEN=${ADMIN_BOT_TOKEN}
volumes:
- ./data:/app/data:Z
network_mode: host
command: python admin_bot.py
youtube-downloader:
image: 192.168.8.174:3000/vrubel/video-youtube:latest
container_name: youtube_downloader_service
restart: unless-stopped
volumes:
- ./youtube-downloads:/app/downloads
environment:
- YOUTUBE_COOKIES_FILE=/app/youtube_cookies.txt
- PORT=5557
network_mode: host
instagram-downloader:
image: 192.168.8.174:3000/vrubel/video-instagram:latest
container_name: instagram_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./instagram-downloads:/app/downloads
environment:
- INSTAGRAM_COOKIES_FILE=/app/instagram_cookies.txt
- PORT=5556
vk-downloader:
image: 192.168.8.174:3000/vrubel/video-vk:latest
container_name: vk_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./vk-downloads:/app/downloads
environment:
- PORT=5555
- GUNICORN_WORKERS=2
- GUNICORN_THREADS=4
- GUNICORN_TIMEOUT=360
- GUNICORN_KEEP_ALIVE=5
yapfiles-downloader:
image: 192.168.8.174:3000/vrubel/video-yapfiles:latest
container_name: yapfiles_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./yapfiles-downloads:/app/downloads
environment:
- PORT=5558
tiktok-downloader:
image: 192.168.8.174:3000/vrubel/video-tiktok:latest
container_name: tiktok_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./tiktok-downloads:/app/downloads
environment:
- PORT=5559

View file

@ -1,6 +1,7 @@
services: services:
bot: bot:
build: . build: .
image: 192.168.8.174:3000/vrubel/video-bot:latest
container_name: video_download_bot container_name: video_download_bot
restart: unless-stopped restart: unless-stopped
env_file: env_file:
@ -22,6 +23,7 @@ services:
admin_bot: admin_bot:
build: . build: .
image: 192.168.8.174:3000/vrubel/video-admin-bot:latest
container_name: admin_bot container_name: admin_bot
restart: unless-stopped restart: unless-stopped
env_file: env_file:
@ -32,3 +34,64 @@ services:
- ./data:/app/data:Z - ./data:/app/data:Z
network_mode: host network_mode: host
command: python admin_bot.py command: python admin_bot.py
youtube-downloader:
build: ./youtube-downloader
image: 192.168.8.174:3000/vrubel/video-youtube:latest
container_name: youtube_downloader_service
restart: unless-stopped
volumes:
- ./youtube-downloader/downloads:/app/downloads
environment:
- YOUTUBE_COOKIES_FILE=/app/youtube_cookies.txt
- PORT=5557
network_mode: host
instagram-downloader:
build: ./instagram-downloader
image: 192.168.8.174:3000/vrubel/video-instagram:latest
container_name: instagram_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./instagram-downloader/downloads:/app/downloads
environment:
- INSTAGRAM_COOKIES_FILE=/app/instagram_cookies.txt
- PORT=5556
vk-downloader:
build: ./vk-downloader
image: 192.168.8.174:3000/vrubel/video-vk:latest
container_name: vk_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./vk-downloader/downloads:/app/downloads
environment:
- PORT=5555
- GUNICORN_WORKERS=2
- GUNICORN_THREADS=4
- GUNICORN_TIMEOUT=360
- GUNICORN_KEEP_ALIVE=5
yapfiles-downloader:
build: ./yapfiles-downloader
image: 192.168.8.174:3000/vrubel/video-yapfiles:latest
container_name: yapfiles_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./yapfiles-downloader/downloads:/app/downloads
environment:
- PORT=5558
tiktok-downloader:
build: ./tiktok-downloader
image: 192.168.8.174:3000/vrubel/video-tiktok:latest
container_name: tiktok_downloader_service
restart: unless-stopped
network_mode: host
volumes:
- ./tiktok-downloader/downloads:/app/downloads
environment:
- PORT=5559