Поддержка Docker + drone CI/CD

master
Andrey 5 months ago
parent b5c86fb6cd
commit 1f15630680

@ -0,0 +1,64 @@
kind: pipeline
name: default
type: docker
steps:
- name: build
image: docker/compose:latest
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker-compose build
- name: push
image: docker/compose:latest
volumes:
- name: docker_sock
path: /var/run/docker.sock
environment:
REGISTRY_USERNAME:
from_secret: REGISTRY_USERNAME
REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD
commands:
- docker login https://registry.mootfrost.ru -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD
- docker-compose push
- name: deploy
image: docker/compose:latest
volumes:
- name: docker_sock
path: /var/run/docker.sock
environment:
API_ID:
from_secret: API_ID
API_HASH:
from_secret: API_HASH
BOT_TOKEN:
from_secret: BOT_TOKEN
POSTGRES_HOST:
from_secret: POSTGRES_HOST
POSTGRES_USER:
from_secret: POSTGRES_USER
POSTGRES_PASSWORD:
from_secret: POSTGRES_PASSWORD
commands:
- export API_ID=${API_ID}
- export API_HASH=${API_HASH}
- export BOT_TOKEN=${BOT_TOKEN}
- export POSTGRES_HOST=${POSTGRES_HOST}
- export POSTGRES_USER=${POSTGRES_USER}
- export POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- docker-compose -p mootfrost-dev up -d
- name: prune
image: docker/compose:latest
volumes:
- name: docker_sock
path: /var/run/docker.sock
commands:
- docker image prune -f
volumes:
- name: docker_sock
host:
path: /var/run/docker.sock

@ -0,0 +1,9 @@
FROM python:3.8-slim-buster
WORKDIR .
COPY requirements.txt .
RUN pip install -r --no-cache-dir requirements.txt
COPY . .
CMD python main.py

@ -0,0 +1,34 @@
version: '3.8'
services:
bot:
image: registry.mootfrost.ru/novagon/bot:latest
container_name: bot
restart: always
environment:
- API_ID=${API_ID}
- API_HASH=${API_HASH}
- BOT_TOKEN=${BOT_TOKEN}
- SESSION_NAME=NoVagonBot
- GOOGLE_PROJECT_ID=novagon-rg9f
- GOOGLE_APPLICATION_CREDENTIALS=df_key.json
- GOOGLE_MODEL_LANGUAGE=ru
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_DATABASE=postgres
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_USER}
- POSTGRES_PORT=5432
build: .
volumes:
- /etc/telegram-api
database:
image: postgres:alpine
container_name: database
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_USER}
volumes:
- ./data:/var/lib/postgresql/novagon/data
ports:
- "5432:5432"

@ -189,7 +189,9 @@ async def process_message(msg):
'Вагончиками балуемся?',
'Вагоны тут не приветствуются',
'Надоел уже со своими вагонами']))
await msg.respond('Бот работает в режиме обучения, напишите /report в ответ на сообщение, если оно не было распознано или распознано по ошибке')
if random.randint(0, 6) == 1:
await msg.respond(
'Бот работает в режиме обучения, напишите /report в ответ на сообщение, если оно не было распознано или распознано по ошибке')
await bot.edit_permissions(msg.chat_id, msg.sender_id, timedelta(minutes=10), send_messages=False)
raise events.StopPropagation

Loading…
Cancel
Save