fix
This commit is contained in:
@@ -1,19 +1,29 @@
|
||||
FROM alpine:3.20
|
||||
ARG SINGBOX_VER=1.8.10
|
||||
ARG VLESS_URL
|
||||
RUN apk add --no-cache curl ca-certificates tar jq bash coreutils netcat-openbsd python3 && update-ca-certificates \
|
||||
&& curl -L -o /tmp/sb.tar.gz https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VER}/sing-box-${SINGBOX_VER}-linux-amd64.tar.gz \
|
||||
|
||||
# Устанавливаем зависимости, включая dos2unix для исправления скриптов
|
||||
RUN apk add --no-cache curl ca-certificates tar jq bash coreutils netcat-openbsd python3 dos2unix && update-ca-certificates
|
||||
|
||||
# Автоматическое определение архитектуры и установка sing-box
|
||||
RUN ARCH=$(uname -m) && \
|
||||
if [ "$ARCH" = "x86_64" ]; then SB_ARCH="amd64"; \
|
||||
elif [ "$ARCH" = "aarch64" ]; then SB_ARCH="arm64"; \
|
||||
else SB_ARCH="amd64"; fi && \
|
||||
curl -L -o /tmp/sb.tar.gz https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VER}/sing-box-${SINGBOX_VER}-linux-${SB_ARCH}.tar.gz \
|
||||
&& tar -xf /tmp/sb.tar.gz -C /tmp \
|
||||
&& mv /tmp/sing-box-${SINGBOX_VER}-linux-amd64/sing-box /usr/local/bin/sing-box \
|
||||
&& mv /tmp/sing-box-${SINGBOX_VER}-linux-${SB_ARCH}/sing-box /usr/local/bin/sing-box \
|
||||
&& chmod +x /usr/local/bin/sing-box \
|
||||
&& adduser -D -u 1000 suser
|
||||
|
||||
COPY --chown=suser:suser config/client.template.json /app/
|
||||
COPY --chown=suser:suser scripts/gen-client-from-url.sh scripts/menu.sh /app/
|
||||
COPY --chown=suser:suser docker/entrypoint.sh /app/
|
||||
COPY --chown=suser:suser web/ /app/web/
|
||||
RUN chmod +x /app/gen-client-from-url.sh /app/entrypoint.sh /app/menu.sh
|
||||
|
||||
# Исправляем окончания строк (важно для Windows пользователей) и даем права на запуск
|
||||
RUN dos2unix /app/*.sh && chmod +x /app/gen-client-from-url.sh /app/entrypoint.sh /app/menu.sh
|
||||
|
||||
ENV VLESS_URL=$VLESS_URL
|
||||
|
||||
EXPOSE 8082 9090 3456
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
@@ -14,8 +14,9 @@ from pathlib import Path
|
||||
|
||||
PORT = 3456
|
||||
APP_DIR = Path(__file__).parent
|
||||
WEB_DIR = APP_DIR / "web"
|
||||
DATA_DIR = APP_DIR / "data"
|
||||
BASE_DIR = APP_DIR.parent
|
||||
WEB_DIR = APP_DIR
|
||||
DATA_DIR = BASE_DIR / "data"
|
||||
CONFIG_FILE = DATA_DIR / "client.json"
|
||||
|
||||
|
||||
@@ -119,12 +120,12 @@ class ProxyControlHandler(http.server.BaseHTTPRequestHandler):
|
||||
return
|
||||
|
||||
# Run gen-client-from-url.sh
|
||||
script_path = APP_DIR / "gen-client-from-url.sh"
|
||||
script_path = BASE_DIR / "gen-client-from-url.sh"
|
||||
result = subprocess.run(
|
||||
[str(script_path), url, str(CONFIG_FILE)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
cwd=str(APP_DIR),
|
||||
cwd=str(BASE_DIR),
|
||||
timeout=30
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user