From 7ad2f77165e9dddf2fa1bcfc5f7c063c9d95a4af Mon Sep 17 00:00:00 2001 From: deexsed Date: Mon, 30 Mar 2026 16:30:45 +0300 Subject: [PATCH] docker: entrypoint script and CRLF-safe build https://github.com/Flowseal/tg-ws-proxy/issues/490#issuecomment-4154668985 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Вынес инлайн-команду из ENTRYPOINT в отдельный скрипт docker/entrypoint.sh. Так надёжнее: не нужно мучиться с экранированием кавычек и копипастой (https://github.com/Flowseal/tg-ws-proxy/issues/490#issuecomment-4154668985). Добавил запуск sed прямо в образе, чтобы срезать символы `CR` --- .gitattributes | 1 + Dockerfile | 4 +++- docker/entrypoint.sh | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 docker/entrypoint.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ef97a0a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +docker/entrypoint.sh text eol=lf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b0d9462..2e20c83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,10 +36,12 @@ WORKDIR /app COPY --from=builder /opt/venv /opt/venv COPY proxy ./proxy COPY README.md LICENSE ./ +COPY docker/entrypoint.sh ./docker/entrypoint.sh +RUN sed -i 's/\r$//' ./docker/entrypoint.sh && chmod +x ./docker/entrypoint.sh USER app EXPOSE 1443/tcp -ENTRYPOINT ["/usr/bin/tini", "--", "/bin/sh", "-lc", "set -eu; args=\"--host ${TG_WS_PROXY_HOST} --port ${TG_WS_PROXY_PORT}\"; for dc in ${TG_WS_PROXY_DC_IPS}; do args=\"$args --dc-ip $dc\"; done; exec python -u proxy/tg_ws_proxy.py $args \"$@\"", "--"] +ENTRYPOINT ["/usr/bin/tini", "--", "/app/docker/entrypoint.sh"] CMD [] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..b05542a --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -eu +args="--host ${TG_WS_PROXY_HOST} --port ${TG_WS_PROXY_PORT}" +for dc in ${TG_WS_PROXY_DC_IPS}; do + args="$args --dc-ip $dc" +done +exec python -u proxy/tg_ws_proxy.py $args "$@"