Files
sub-store/Dockerfile
T
rogee 040e3ebab1 fix: fetcher proxy support, Dockerfile sing-box, rename index format
1. sslinks 403: Cloudflare blocks server IP. Add fetcher.proxy_url config
   so subscription/flow requests can route through an HTTP proxy.

2. Egress probe: Docker image lacked sing-box. Install sing-box v1.11.4
   in the Alpine runtime stage.

3. Collection rename: group by display baseName instead of internal
   groupKey, format index as -N instead of %02d. Fixes double-suffix
   issue where EnsureUniqueProxyNames appended -2/-3 onto existing  02.
2026-07-28 17:38:57 +08:00

41 lines
1.3 KiB
Docker

# ─── Stage 1: Build frontend ───
FROM node:22-alpine AS frontend-builder
WORKDIR /frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --production=false
COPY frontend/ .
RUN npm run build
# ─── Stage 2: Build backend ───
FROM golang:1.26-alpine AS backend-builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /sub-store .
# ─── Stage 3: Runtime ───
FROM alpine:3.21
RUN apk add --no-cache ca-certificates tzdata && \
wget -qO /tmp/sing-box.tar.gz "https://github.com/SagerNet/sing-box/releases/download/v1.11.4/sing-box-1.11.4-linux-amd64.tar.gz" && \
tar xzf /tmp/sing-box.tar.gz -C /tmp && \
mv /tmp/sing-box-*/sing-box /usr/local/bin/sing-box && \
chmod +x /usr/local/bin/sing-box && \
rm -rf /tmp/sing-box*
WORKDIR /app
COPY --from=backend-builder /sub-store /app/sub-store
COPY --from=frontend-builder /frontend/dist /app/frontend/dist
COPY config/config.example.yaml /app/config/config.example.yaml
RUN mkdir -p /app/data
ENV TZ=Asia/Shanghai
ENV SUB_STORE_CONFIG=/app/config/config.yaml
ENV SUB_STORE_FRONTEND_DIR=/app/frontend/dist
EXPOSE 3000
ENTRYPOINT ["/app/sub-store"]
CMD ["serve", "-c", "/app/config/config.yaml"]