Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI # Название, которое будет отображаться

on: # События. Запускаются при пуше в main или develop, или при создании pull request в main
push:
branches: [main, develop]
branches: [ main ]
pull_request:
branches: [ main ]

Expand Down Expand Up @@ -80,3 +80,43 @@ jobs: # Задачи
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.xml

build-and-push: # Собираем образ проекта и пушим а реестр
runs-on: ubuntu-latest
needs: tests
# ограничиваем запуск только на push в main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
-
uses: actions/checkout@v4 # Скачивает код из репы на виртуалку.
-
name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up Docker Build

uses: docker/setup-buildx-action@v4
-
name: Build and Push API
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile.api
push: true
tags: |
ghcr.io/fl1rix/steeltime-api:latest
ghcr.io/fl1rix/steeltime-api:${{ github.sha }}
-
name: Build and Push Bot
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile.bot
push: true
tags: |
ghcr.io/fl1rix/steeltime-bot:latest
ghcr.io/fl1rix/steeltime-bot:${{ github.sha }}
18 changes: 8 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ services:
mem_reservation: 256m

api:
build:
context: .
dockerfile: Dockerfile.api
args: # Кэш для быстрой сборки
- BUILDKIT_INLINE_CACHE=1
image: ghcr.io/fl1rix/steeltime-api:latest
ports:
- "8000:8000" # Формат: порт на пк: порт в контейнере
env_file:
Expand All @@ -42,11 +38,7 @@ services:


bot:
build:
context: .
dockerfile: Dockerfile.bot
args: # Кэш для быстрой сборки
- BUILDKIT_INLINE_CACHE=1
image: ghcr.io/fl1rix/steeltime-bot:latest
restart: unless-stopped
env_file:
- .env
Expand All @@ -58,6 +50,12 @@ services:
mem_limit: 256m
cpus: 0.25

watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 300

volumes:
postgres_data:
driver: local
Expand Down
Loading