Skip to content

feat(ci): Add Docker image building and pushing to the ghcr registry#18

Merged
Fl1riX merged 3 commits into
mainfrom
feature/ghcr-deployment
May 23, 2026
Merged

feat(ci): Add Docker image building and pushing to the ghcr registry#18
Fl1riX merged 3 commits into
mainfrom
feature/ghcr-deployment

Conversation

@Fl1riX
Copy link
Copy Markdown
Owner

@Fl1riX Fl1riX commented May 23, 2026

Summary by Sourcery

Добавить этапы сборки и публикации Docker-образов в конвейер CI для push-событий в ветку main.

CI:

  • Ограничить триггер CI по push только веткой main.
  • Добавить задачу build-and-push, которая собирает Docker-образы API и бота и отправляет их в GitHub Container Registry после успешного прохождения тестов.
Original summary in English

Summary by Sourcery

Add Docker image build and publish steps to the CI pipeline for main branch pushes.

CI:

  • Restrict CI push trigger to the main branch only.
  • Add a build-and-push job that builds API and bot Docker images and pushes them to GitHub Container Registry after tests succeed.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 23, 2026

Руководство для рецензента

Настраивает CI на запуск только для ветки main и добавляет Docker-задачу сборки и публикации, которая после успешного прохождения тестов выполняет вход в GitHub Container Registry и собирает/публикует образы API и Bot, используя выделенные Dockerfile.

Блок-схема CI-процесса со сборкой и публикацией Docker-образов

flowchart TD
  push_main[Push to main] --> ci_workflow[CI workflow]
  ci_workflow --> tests_job[tests job]
  tests_job --> build_and_push_job[build-and-push job]
  build_and_push_job --> login_ghcr[docker/login-action]
  login_ghcr --> setup_buildx[docker/setup-buildx-action]
  setup_buildx --> build_push_api[docker/build-push-action API]
  setup_buildx --> build_push_bot[docker/build-push-action Bot]
  build_push_api --> ghcr_api[ghcr.io steeltime-api image]
  build_push_bot --> ghcr_bot[ghcr.io steeltime-bot image]
Loading

Изменения на уровне файлов

Изменение Детали Файлы
Ограничить триггеры CI только веткой main.
  • Обновить ветки триггера push с [main, develop] до [main] в GitHub Actions workflow
  • Убедиться, что триггер pull_request остаётся ограниченным веткой main
.github/workflows/ci.yml
Добавить в CI GitHub Actions задачу сборки и публикации Docker-образов.
  • Добавить задачу build-and-push, зависящую от задачи tests и запускаемую только при push-событиях в main
  • Добавить шаг входа в GitHub Container Registry с использованием docker/login-action
  • Настроить Docker Buildx через docker/setup-buildx-action
  • Добавить шаги сборки и публикации образов API и Bot с использованием отдельных Dockerfile и тегированием их в пространстве имён ghcr.io
.github/workflows/ci.yml

Подсказки и команды

Взаимодействие с Sourcery

  • Запустить новое ревью: Оставьте комментарий @sourcery-ai review в pull request.
  • Продолжить обсуждение: Отвечайте напрямую на комментарии ревью от Sourcery.
  • Создать задачу GitHub из комментария ревью: Попросите Sourcery создать
    задачу из комментария ревью, ответив на него. Можно также ответить на
    комментарий ревью с @sourcery-ai issue, чтобы создать задачу из него.
  • Сгенерировать заголовок pull request: Напишите @sourcery-ai в любом месте
    заголовка pull request, чтобы сгенерировать заголовок в любой момент. Можно также оставить комментарий
    @sourcery-ai title в pull request, чтобы (пере)сгенерировать заголовок в любое время.
  • Сгенерировать краткое описание pull request: Напишите @sourcery-ai summary в любом месте
    тела pull request, чтобы сгенерировать краткое описание PR в нужном вам месте. Можно также оставить комментарий
    @sourcery-ai summary в pull request, чтобы (пере)сгенерировать краткое описание в любое время.
  • Сгенерировать руководство для рецензента: Оставьте комментарий @sourcery-ai guide в pull
    request, чтобы (пере)сгенерировать руководство для рецензента в любое время.
  • Отметить все комментарии Sourcery как решённые: Оставьте комментарий @sourcery-ai resolve в pull
    request, чтобы пометить все комментарии Sourcery как решённые. Полезно, если вы уже
    учли все замечания и не хотите больше их видеть.
  • Отклонить все ревью Sourcery: Оставьте комментарий @sourcery-ai dismiss в pull
    request, чтобы отклонить все существующие ревью Sourcery. Особенно полезно, если вы
    хотите начать заново с новым ревью — не забудьте оставить комментарий
    @sourcery-ai review, чтобы запустить новое ревью!

Настройка вашего опыта

Перейдите в свою панель управления, чтобы:

  • Включать или отключать функции ревью, такие как автоматически сгенерированное Sourcery
    краткое описание pull request, руководство для рецензента и другие.
  • Изменить язык ревью.
  • Добавлять, удалять или редактировать пользовательские инструкции для ревью.
  • Настроить другие параметры ревью.

Получение помощи

Original review guide in English

Reviewer's Guide

Configures CI to run only on main and adds a Docker-based build-and-push job that, after tests pass, logs into GitHub Container Registry and builds/pushes API and Bot images using dedicated Dockerfiles.

Flow diagram for CI workflow with Docker image build and push

flowchart TD
  push_main[Push to main] --> ci_workflow[CI workflow]
  ci_workflow --> tests_job[tests job]
  tests_job --> build_and_push_job[build-and-push job]
  build_and_push_job --> login_ghcr[docker/login-action]
  login_ghcr --> setup_buildx[docker/setup-buildx-action]
  setup_buildx --> build_push_api[docker/build-push-action API]
  setup_buildx --> build_push_bot[docker/build-push-action Bot]
  build_push_api --> ghcr_api[ghcr.io steeltime-api image]
  build_push_bot --> ghcr_bot[ghcr.io steeltime-bot image]
Loading

File-Level Changes

Change Details Files
Limit CI triggers to main branch only.
  • Update push trigger branches from [main, develop] to [main] in GitHub Actions workflow
  • Ensure pull_request trigger remains limited to main branch
.github/workflows/ci.yml
Add Docker image build-and-push job to GitHub Actions CI.
  • Introduce build-and-push job that depends on tests job and runs only on push events to main
  • Add step to log in to GitHub Container Registry using docker/login-action
  • Configure Docker Buildx setup via docker/setup-buildx-action
  • Add build-and-push steps for API and Bot images using separate Dockerfiles and tagging them in ghcr.io namespace
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет — я нашёл 1 проблему и оставил немного общего фидбэка:

  • Обновление триггера push так, чтобы он запускался только на main, означает, что CI (включая новый Docker-сборку) больше не будет запускаться при пушах в develop. Пожалуйста, перепроверьте, соответствует ли это вашей планируемой стратегии ветвления, чтобы изменения в develop не сливались без обратной связи от CI.
  • Docker-образы помечаются только тегом latest; стоит также добавлять тег с неизменяемым идентификатором, например, SHA коммита или версией (например, ${{ github.sha }}), чтобы упростить откаты и отладку и избежать неоднозначности в том, какой код задеплоен.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Updating the `push` trigger to only run on `main` means CI (including the new Docker build) will no longer run on `develop` pushes; double-check this matches your intended branching strategy so changes in `develop` aren’t merged without CI feedback.
- The Docker images are only tagged as `latest`; consider also tagging with something immutable like the commit SHA or a version (e.g., `${{ github.sha }}`) to make rollbacks and debugging easier and avoid ambiguity around which code is deployed.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="110-118" />
<code_context>
+          context: .
+          file: Dockerfile.api
+          push: true
+          tags: ghcr.io/fl1rix/steeltime-api:latest
+      - 
+        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
\ No newline at end of file
</code_context>
<issue_to_address>
**suggestion:** Add immutable tags (e.g., commit SHA) in addition to `latest` to make image versions traceable.

Relying only on `latest` means each push to `main` overwrites the previous image, making rollbacks and debugging difficult. Please also tag images with an immutable identifier (e.g. `${{ github.sha }}`), for example:

`tags: ghcr.io/fl1rix/steeltime-api:latest,ghcr.io/fl1rix/steeltime-api:${{ github.sha }}`

so you can reliably link running images back to a specific commit and perform safe rollbacks.

Suggested implementation:

```
          tags: ghcr.io/fl1rix/steeltime-api:latest,ghcr.io/fl1rix/steeltime-api:${{ github.sha }}

```

```
          tags: ghcr.io/fl1rix/steeltime-bot:latest,ghcr.io/fl1rix/steeltime-bot:${{ github.sha }}

```
</issue_to_address>

Sourcery бесплатен для open source — если вам нравятся наши ревью, пожалуйста, подумайте о том, чтобы поделиться ими ✨
Помогите мне стать полезнее! Пожалуйста, нажимайте 👍 или 👎 на каждом комментарии — я использую этот фидбэк, чтобы улучшать ваши ревью.
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • Updating the push trigger to only run on main means CI (including the new Docker build) will no longer run on develop pushes; double-check this matches your intended branching strategy so changes in develop aren’t merged without CI feedback.
  • The Docker images are only tagged as latest; consider also tagging with something immutable like the commit SHA or a version (e.g., ${{ github.sha }}) to make rollbacks and debugging easier and avoid ambiguity around which code is deployed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Updating the `push` trigger to only run on `main` means CI (including the new Docker build) will no longer run on `develop` pushes; double-check this matches your intended branching strategy so changes in `develop` aren’t merged without CI feedback.
- The Docker images are only tagged as `latest`; consider also tagging with something immutable like the commit SHA or a version (e.g., `${{ github.sha }}`) to make rollbacks and debugging easier and avoid ambiguity around which code is deployed.

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="110-118" />
<code_context>
+          context: .
+          file: Dockerfile.api
+          push: true
+          tags: ghcr.io/fl1rix/steeltime-api:latest
+      - 
+        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
\ No newline at end of file
</code_context>
<issue_to_address>
**suggestion:** Add immutable tags (e.g., commit SHA) in addition to `latest` to make image versions traceable.

Relying only on `latest` means each push to `main` overwrites the previous image, making rollbacks and debugging difficult. Please also tag images with an immutable identifier (e.g. `${{ github.sha }}`), for example:

`tags: ghcr.io/fl1rix/steeltime-api:latest,ghcr.io/fl1rix/steeltime-api:${{ github.sha }}`

so you can reliably link running images back to a specific commit and perform safe rollbacks.

Suggested implementation:

```
          tags: ghcr.io/fl1rix/steeltime-api:latest,ghcr.io/fl1rix/steeltime-api:${{ github.sha }}

```

```
          tags: ghcr.io/fl1rix/steeltime-bot:latest,ghcr.io/fl1rix/steeltime-bot:${{ github.sha }}

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/ci.yml Outdated
@Fl1riX Fl1riX force-pushed the feature/ghcr-deployment branch from f679593 to 5fc98fc Compare May 23, 2026 11:28
@Fl1riX Fl1riX merged commit 9de9d59 into main May 23, 2026
4 checks passed
@Fl1riX Fl1riX deleted the feature/ghcr-deployment branch May 23, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant