Files
mirror-3x-ui/.oss-scanner/Dockerfile
T
Sanaei a2bc42c3a1 chore(deps): update go, frontend and docs dependencies
Go: amneziawg-go, pgx 5.13, telego 1.14, fasthttp 1.80, x/net 0.63,
klauspost/compress and matching indirect modules.
Frontend: vitest group 5.1.1 with addon-vitest overrides, storybook
10.6.8, react-query, antd, i18next, react-router, msw, playwright.
Docs: fumadocs 16.19, next 16.4.6, mermaid 12.3, tailwind 4.3.5,
vitest 5.1.1; release-age waivers pruned, none appended.
Toolchain: restore the pnpm packageManager hash, align the oss-scanner
image with Go 1.27.4.

Held: xray-core untagged pins (gvisor, apernet/quic-go, utls, reality);
modules and oxlint 1.95 / oxfmt 0.80 released under a day ago.
2026-11-23 22:36:08 +03:30

60 lines
2.5 KiB
Docker

# Build environment for Anthropic's OSS Scanner (https://github.com/anthropics/oss-scanner).
# The scanner builds this with the repository as the context, then audits the image offline:
# everything the build, the tests and a reproducer need must be fetched here.
FROM node:26-trixie-slim AS node
FROM golang:1.27.4-trixie
ENV DEBIAN_FRONTEND=noninteractive \
CGO_ENABLED=1 \
CGO_CFLAGS="-D_LARGEFILE64_SOURCE" \
GOTOOLCHAIN=local
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates curl git jq procps sqlite3 unzip \
&& rm -rf /var/lib/apt/lists/*
# Node 26 is required: `make gen` imports .ts files directly and needs its type stripping.
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
&& node --version && npm --version
# scanner contract: the checkout lives inside the image, at /src
COPY . /src
WORKDIR /src
RUN go mod download && go mod verify
# The Go binary embeds the Vite build from internal/web/dist, so the frontend goes first.
# HUSKY=0 skips the git-hook install, which needs a .git directory the build context may lack.
RUN cd frontend && HUSKY=0 npm ci && npm run build
# Debug info and no inlining, so stack traces and debuggers map straight to the source.
RUN go build -gcflags=all="-N -l" -o /usr/local/bin/x-ui . \
&& ln -s /usr/local/bin/x-ui /src/x-ui
# Xray-core, the mtg-multi MTProto sidecar and the geo databases, exactly as the release image ships them.
RUN ./DockerInit.sh "$(dpkg --print-architecture)" \
&& ln -s "/src/build/bin/xray-linux-$(dpkg --print-architecture)" /usr/local/bin/xray \
&& xray version
# Turns on the xray gRPC end-to-end tests (internal/xray, internal/amneziawgnet) against the real core.
ENV XRAY_E2E_BINARY=/usr/local/bin/xray
# Baseline tests: also warms the build cache. A failure is logged, never fatal.
RUN go test -count=1 -timeout 30m ./... > /src/.oss-scanner-go-test.log 2>&1 \
|| echo "WARNING: go test reported failures, see /src/.oss-scanner-go-test.log"
RUN cd frontend && npx vitest run --project unit --project components > /src/.oss-scanner-vitest.log 2>&1 \
|| echo "WARNING: vitest reported failures, see /src/.oss-scanner-vitest.log"
# Reproducers and patches must build with the network gone.
ENV GOPROXY=off \
GOSUMDB=off \
GOFLAGS=-mod=readonly \
npm_config_offline=true
CMD ["bash"]