Remove default CPU/memory caps and add LTO build optimization

- Default PROXY_CPUS and PROXY_MEMORY now empty (use full system resources)
- Docker run skips --cpus/--memory flags when not set
- Dockerfile: enable LTO, codegen-units=1 for optimized binary
This commit is contained in:
SamNet-dev
2026-02-19 02:32:08 -06:00
parent f571f05c61
commit bca1fda425
2 changed files with 14 additions and 11 deletions

View File

@@ -47,6 +47,7 @@ jobs:
RUN git clone "https://github.com/${TELEMT_REPO}.git" /build
WORKDIR /build
RUN git checkout "${TELEMT_COMMIT}"
ENV CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_DEBUG=false
RUN cargo build --release && strip target/release/telemt 2>/dev/null || true && cp target/release/telemt /telemt
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*

View File

@@ -101,8 +101,8 @@ PROXY_PORT=443
PROXY_METRICS_PORT=9090
PROXY_DOMAIN="cloudflare.com"
PROXY_CONCURRENCY=8192
PROXY_CPUS="1"
PROXY_MEMORY="256m"
PROXY_CPUS=""
PROXY_MEMORY=""
AD_TAG=""
BLOCKLIST_COUNTRIES=""
MASKING_ENABLED="true"
@@ -2105,15 +2105,17 @@ run_proxy_container() {
# Run container
log_info "Starting telemt proxy on port ${PROXY_PORT}..."
docker run -d \
--name "$CONTAINER_NAME" \
--restart unless-stopped \
--network host \
--log-opt max-size=10m \
--log-opt max-file=3 \
--cpus "${PROXY_CPUS}" \
--memory "${PROXY_MEMORY}" \
--memory-swap "${PROXY_MEMORY}" \
local _docker_args=(
--name "$CONTAINER_NAME"
--restart unless-stopped
--network host
--log-opt max-size=10m
--log-opt max-file=3
)
[ -n "${PROXY_CPUS}" ] && _docker_args+=(--cpus "${PROXY_CPUS}")
[ -n "${PROXY_MEMORY}" ] && _docker_args+=(--memory "${PROXY_MEMORY}" --memory-swap "${PROXY_MEMORY}")
docker run -d "${_docker_args[@]}" \
-v "${CONFIG_DIR}/config.toml:/etc/telemt.toml:ro" \
"$(get_docker_image)" /etc/telemt.toml \
&>/dev/null || {