[PR #3073] [CLOSED] chore: refactor docker files #5341

Closed
opened 2026-10-31 20:46:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3073
Author: @Torotin
Created: 6/7/2025
Status: ❌ Closed

Base: main ← Head: main


📝 Commits (5)

📊 Changes

3 files changed (+326 additions, -43 deletions)

View changed files

📝 DockerEntrypoint.sh (+131 -5)
📝 DockerInit.sh (+183 -35)
📝 Dockerfile (+12 -3)

📄 Description

What is the pull request?

Dockerfile

English

  • Clarify and reorganize comments to explain each step (volume, entrypoint, default command).

Russian

  • Перегруппированы комментарии и команды для понятности (volume, entrypoint, CMD).

DockerEntrypoint.sh

English

  • Replace the minimal shell script with a strict-mode Bash entrypoint.
  • Add graceful SIGTERM handling to shut down x-ui cleanly.
  • Execute user-provided scripts in /mnt/sh/beforestart and /mnt/sh/afterstart, with permission checks and failure handling.
  • Copy any host binaries from /mnt/bin into /app/bin before startup.
  • Consolidate Fail2Ban startup into a function with logging and error reporting.

Russian

  • Заменён простой shell-скрипт на строгий Bash-entrypoint.
  • Добавлена обработка SIGTERM для корректной остановки x-ui.
  • Выполнение скриптов из /mnt/sh/beforestart и /mnt/sh/afterstart с проверкой прав и остановкой при ошибках.
  • Копирование bin-файлов из /mnt/bin в /app/bin перед запуском.
  • Старт Fail2Ban вынесен в функцию с логированием и проверкой ошибок.

DockerInit.sh

English

  • Convert to a Bash script with set -euo pipefail and strict IFS.
  • Define constants for version and URLs, and centralize download logic in functions.
  • Add dependency checks for wget and unzip, with user-friendly errors.
  • Provide built-in usage help and robust architecture detection, defaulting to amd64 if unrecognized.
  • Streamline download/unpack of Xray and GeoIP/GeoSite databases with error handling.

Russian

  • Переписан на Bash с set -euo pipefail и жёстким IFS.
  • Введены константы для версии и шаблонов URL, логика загрузки оформлена функциями.
  • Проверка наличия утилит wget и unzip с понятными сообщениями об ошибках.
  • Реализована справка по использованию и детектирование архитектуры, по умолчанию — amd64.
  • Оптимизировано скачивание и распаковка Xray и баз GeoIP/GeoSite с обработкой ошибок.

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/3073 **Author:** [@Torotin](https://github.com/Torotin) **Created:** 6/7/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (5) - [`1870845`](https://github.com/MHSanaei/3x-ui/commit/187084569fb3bf4e943f2d7256784bd65ef87b16) Push the updated Docker configuration and scripts branch to the remote repository - [`bacbcc6`](https://github.com/MHSanaei/3x-ui/commit/bacbcc61a436112c720f6c2920b844ab0eebb987) Merge branch 'main' into main - [`f7a3ebf`](https://github.com/MHSanaei/3x-ui/commit/f7a3ebf2f3c28d40c1ae126f73ac6a8c9e22c2c6) Merge branch 'main' into main - [`ef7a68a`](https://github.com/MHSanaei/3x-ui/commit/ef7a68abeab7b4bfab045cca30ab4e8d7f4c8ee3) DockerInit rewritten, bash added to dockerfile at build stage - [`f910aa8`](https://github.com/MHSanaei/3x-ui/commit/f910aa814ab093fd3286ec190a2c983479f9ad7f) Merge branch 'main' of https://github.com/Torotin/3x-ui ### 📊 Changes **3 files changed** (+326 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `DockerEntrypoint.sh` (+131 -5) 📝 `DockerInit.sh` (+183 -35) 📝 `Dockerfile` (+12 -3) </details> ### 📄 Description ## What is the pull request? ### Dockerfile **English** - Clarify and reorganize comments to explain each step (volume, entrypoint, default command). **Russian** - Перегруппированы комментарии и команды для понятности (volume, entrypoint, CMD). --- ### DockerEntrypoint.sh **English** - Replace the minimal shell script with a strict-mode Bash entrypoint. - Add graceful SIGTERM handling to shut down x-ui cleanly. - Execute user-provided scripts in `/mnt/sh/beforestart` and `/mnt/sh/afterstart`, with permission checks and failure handling. - Copy any host binaries from `/mnt/bin` into `/app/bin` before startup. - Consolidate Fail2Ban startup into a function with logging and error reporting. **Russian** - Заменён простой shell-скрипт на строгий Bash-entrypoint. - Добавлена обработка SIGTERM для корректной остановки x-ui. - Выполнение скриптов из `/mnt/sh/beforestart` и `/mnt/sh/afterstart` с проверкой прав и остановкой при ошибках. - Копирование bin-файлов из `/mnt/bin` в `/app/bin` перед запуском. - Старт Fail2Ban вынесен в функцию с логированием и проверкой ошибок. --- ### DockerInit.sh **English** - Convert to a Bash script with `set -euo pipefail` and strict IFS. - Define constants for version and URLs, and centralize download logic in functions. - Add dependency checks for `wget` and `unzip`, with user-friendly errors. - Provide built-in usage help and robust architecture detection, defaulting to amd64 if unrecognized. - Streamline download/unpack of Xray and GeoIP/GeoSite databases with error handling. **Russian** - Переписан на Bash с `set -euo pipefail` и жёстким IFS. - Введены константы для версии и шаблонов URL, логика загрузки оформлена функциями. - Проверка наличия утилит `wget` и `unzip` с понятными сообщениями об ошибках. - Реализована справка по использованию и детектирование архитектуры, по умолчанию — amd64. - Оптимизировано скачивание и распаковка Xray и баз GeoIP/GeoSite с обработкой ошибок. --- ## Which part of the application is affected by the change? - [ ] Frontend - [x] Backend ## Type of Changes - [ ] Bug fix - [ ] New feature - [x] Refactoring - [ ] Other --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:46:18 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5341
No description provided.