Files
Wormhole/Dockerfile
T
rose_cat707 0d84b07f68
CI / docker (push) Successful in 1m58s
feat: Wormhole 内网穿透与反向代理网关
Go + Vue 管理台:Agent 隧道、域名反代、IP 安全、访客验证与监控大盘。
Gitea Actions CI 多架构镜像;纯 Go SQLite、无 CGO Docker 构建。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 17:52:43 +08:00

75 lines
1.9 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Wormhole 内网穿透 + 反向代理网关(Go + Vue 管理台)
#
# 构建:
# docker build -t wormhole:latest .
#
# 服务端:
# docker run -d --name wormhole \
# -p 8529:8529 -p 8528:8528 -p 8081:8081 -p 8443:8443 \
# -v wormhole-data:/app/data \
# wormhole:latest
#
# Agent:
# docker run -d --name wormhole-agent --restart=unless-stopped --network host \
# wormhole:latest agent -server <服务端IP>:8528 -key <verify_key>
#
# 生产镜像由 Gitea Actions 构建,见 README
# syntax=docker/dockerfile:1
# 基础镜像默认 Docker HubCI 默认 1Panel 加速(docker.1panel.live),本地可传:
# docker build --build-arg IMAGE_PREFIX=docker.1panel.live/library/ -t wormhole:latest .
ARG IMAGE_PREFIX=
FROM --platform=$BUILDPLATFORM ${IMAGE_PREFIX}node:20-alpine AS web-builder
WORKDIR /src/web
COPY web/package.json web/package-lock.json web/.npmrc ./
RUN npm ci
COPY web/ ./
RUN npm run build
FROM --platform=$BUILDPLATFORM ${IMAGE_PREFIX}golang:1.25-alpine AS go-builder
ARG TARGETARCH
ARG GOPROXY=https://goproxy.cn,direct
ARG GOSUMDB=sum.golang.google.cn
ENV GOPROXY=${GOPROXY} GOSUMDB=${GOSUMDB}
WORKDIR /src
COPY go.mod go.sum go.env ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY web/embed.go ./web/
COPY --from=web-builder /src/web/dist ./web/dist
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH="$TARGETARCH" \
go build -ldflags="-w -s" -o /wormhole ./cmd/wormhole
FROM ${IMAGE_PREFIX}alpine:3.20
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -S wormhole \
&& adduser -S wormhole -G wormhole
WORKDIR /app
COPY --from=go-builder /wormhole /usr/local/bin/wormhole
RUN mkdir -p /app/data \
&& chown -R wormhole:wormhole /app
USER wormhole
VOLUME ["/app/data"]
EXPOSE 8529 8528 8081 8443
ENTRYPOINT ["/usr/local/bin/wormhole"]
CMD ["server"]