Update dockerfiles and github CI piplines

This commit is contained in:
IgorVolochay
2026-08-25 15:30:04 +03:00
parent b1cca197d5
commit de20fa2492
6 changed files with 207 additions and 33 deletions
+58 -13
View File
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
paths:
- '**.py'
- 'app/**'
branches:
- main
- app
@@ -19,13 +19,14 @@ jobs:
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.12
architecture: x64
python-version: "3.12"
cache: pip
cache-dependency-path: app/requirements.txt
- name: Install dependencies
run: |
@@ -42,26 +43,70 @@ jobs:
MONGO_PORT: ${{ secrets.MONGO_PORT }}
MONGO_USER: ${{ secrets.MONGO_USER }}
MONGO_PASS: ${{ secrets.MONGO_PASS }}
RABBIT_HOST: ${{ secrets.RABBIT_HOST }}
RABBIT_PORT: ${{ secrets.RABBIT_PORT }}
RABBIT_USER: ${{ secrets.RABBIT_USER }}
RABBIT_PASS: ${{ secrets.RABBIT_PASS }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.12
architecture: x64
python-version: "3.12"
cache: pip
cache-dependency-path: app/requirements.txt
- name: Setup MongoDB
run: docker run --name mongodb -d -p ${{ secrets.MONGO_PORT }}:27017 -e MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_USER }} -e MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_PASS }} mongodb/mongodb-community-server
- name: Start MongoDB
run: |
docker run -d --name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=$MONGO_USER \
-e MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASS \
mongodb/mongodb-community-server
for i in $(seq 1 30); do
docker exec mongodb mongosh \
--username $MONGO_USER --password $MONGO_PASS \
--eval "db.runCommand({ping:1})" && break
sleep 1
done
- name: Start RabbitMQ
run: |
docker run -d --name rabbitmq \
-p ${{ secrets.RABBIT_PORT }}:5672 \
-e RABBITMQ_DEFAULT_USER=${{ secrets.RABBIT_USER }} \
-e RABBITMQ_DEFAULT_PASS=${{ secrets.RABBIT_PASS }} \
rabbitmq:3.13-alpine
for i in $(seq 1 30); do
docker exec rabbitmq rabbitmq-diagnostics -q ping && break
sleep 1
done
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest==8.3.4 pytest-asyncio==0.25.3 httpx==0.28.1
pip install -r app/requirements.txt
- name: Setup moderated base cards
- name: Setup moderated base cards
working-directory: ./app/tools
run: python3 _add_base_cards.py -a 2 -f data/base_cards.json
- name: Run pytest
run: pytest -vs
run: pytest -vs
docker-build:
runs-on: ubuntu-latest
needs: [mypy, pytest]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build backend image
run: docker build -f app/dockerfile.app -t tort-backend:ci ./app
- name: Build bot image
run: docker build -f app/dockerfile.bot -t tort-tg-bot:ci ./app