mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-07-01 12:32:09 +00:00
![google-labs-jules[bot]](/assets/img/avatar_default.png)
This commit addresses two primary issues in the backend Docker setup: 1. **Database Initialization Error (CGO_ENABLED):** The Go binary was previously compiled with `CGO_ENABLED=0`. This caused an error ("Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work") because `go-sqlite3` requires CGo. - Modified `Dockerfile.backend` to set `CGO_ENABLED=1` during the build. - Added `gcc`, `musl-dev`, and `sqlite-dev` to the builder stage dependencies for CGo compilation on Alpine. - Added `sqlite` to the final image stage for runtime library availability. 2. **fail2ban-client Not Found Error:** The `DockerEntrypoint.sh` script attempted to start `fail2ban-client` without ensuring its presence in the image. - Added `fail2ban` to the `apk add` command in the final stage of `Dockerfile.backend`. - Updated `DockerEntrypoint.sh` to check if `fail2ban-client` is available before attempting to start it, preventing errors if it's not found (e.g., if `XUI_ENABLE_FAIL2BAN` is true but installation failed). These changes should allow the backend container to build and start correctly, resolving the reported database and fail2ban errors. You will need to run `docker compose up -d --build` to apply these changes.
13 lines
278 B
Bash
13 lines
278 B
Bash
#!/bin/sh
|
|
|
|
# Start fail2ban
|
|
if [ "$XUI_ENABLE_FAIL2BAN" = "true" ]; then
|
|
if command -v fail2ban-client >/dev/null 2>&1; then
|
|
fail2ban-client -x start
|
|
else
|
|
echo "Warning: fail2ban-client not found, but XUI_ENABLE_FAIL2BAN is true."
|
|
fi
|
|
fi
|
|
|
|
# Run x-ui
|
|
exec /app/x-ui
|