litellm/ui/Dockerfile
namnt2307 80ab87d4bf feat(ui): opt-in IPv6 listen via NGINX_LISTEN_IPV6
Default behavior is unchanged: nginx binds IPv4 only. Setting
NGINX_LISTEN_IPV6=true renders listen [::]:3000 through an entrypoint
snippet; =auto does the same only when the container has an IPv6 stack,
using the /proc/net/if_inet6 gate the stock image's
10-listen-on-ipv6-by-default.sh already uses for default.conf (which this
image deletes). Read-only filesystems degrade to IPv4 with a log line
instead of failing the entrypoint
2026-08-10 13:21:54 +07:00

45 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1.7
# UI container — Next.js static export served by nginx.
ARG UI_BUILD_IMAGE=node:24.19-alpine3.24@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43
ARG NGINX_VERSION=1.27-alpine
# ---------- builder ----------
FROM ${UI_BUILD_IMAGE} AS builder
ENV NEXT_TELEMETRY_DISABLED=1 \
npm_config_fund=false \
npm_config_audit=false
WORKDIR /app
# Layer the lockfile-only install above the source copy so source-only
# edits don't bust the install cache.
COPY ui/litellm-dashboard/package.json ui/litellm-dashboard/package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --prefer-offline
COPY ui/litellm-dashboard/ ./
RUN npm run build
# ---------- runtime ----------
FROM nginx:${NGINX_VERSION} AS runtime
# Drop the upstream default :80 server; we own the config.
RUN rm -f /etc/nginx/conf.d/default.conf && mkdir /etc/nginx/listen-ipv6
# Opt-in IPv6 listen (NGINX_LISTEN_IPV6=true|auto) — see the script header.
COPY --chmod=755 ui/docker-entrypoint.d/15-listen-on-ipv6.sh /docker-entrypoint.d/
# Static export → web root.
COPY --from=builder /app/out /usr/share/nginx/html
# Routing rules — see ui/nginx.conf for the full description.
COPY ui/nginx.conf /etc/nginx/nginx.conf
EXPOSE 3000/tcp
# nginx as PID 1 in foreground; respects SIGTERM out of the box, so
# no tini/dumb-init wrapper needed.
CMD ["nginx", "-g", "daemon off;"]