Files
admin 81e47d4b12
Build way-node / Build and Push (push) Successful in 1m10s
fix: 镜像与 release 都带上 xbctl
装 way-node 时报:
  curl: (22) The requested URL returned error: 404
  [ERROR] Failed to download xbctl from .../releases/download/<tag>/xbctl-linux-amd64

install.sh 除了 way-node 还要下 xbctl(配套 CLI),而 Dockerfile 只编了
way-node、release 也只挂了 way-node 资产。

- Dockerfile: builder 阶段同时 go build cmd/xbctl,运行时 COPY 进 /usr/local/bin
- workflow: extract 步骤从镜像里把 xbctl 也 cp 出来
- workflow: release 上传改成循环,way-node 与 xbctl 各挂一个资产
2026-11-27 12:10:33 +08:00

54 lines
1.6 KiB
Docker

# Build stage
FROM golang:1.26-alpine AS builder
RUN apk add --no-cache git
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags "-s -w \
-X main.version=$(git describe --tags --always --dirty 2>/dev/null || echo dev) \
-X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-tags "with_quic with_utls with_wireguard with_clash_api" \
-o way-node ./cmd/way-node && \
CGO_ENABLED=0 go build -ldflags "-s -w" \
-o xbctl ./cmd/xbctl
# Runtime stage — sing-box & xray-core are embedded as Go libraries
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
COPY --from=builder /build/way-node /usr/local/bin/way-node
COPY --from=builder /build/xbctl /usr/local/bin/xbctl
RUN mkdir -p /etc/way-node
WORKDIR /etc/way-node
# Config can be provided via file mount OR environment variables.
# Env var mode (no config file needed):
# docker run -d --network=host \
# -e apiHost=https://panel.example.com \
# -e apiKey=YOUR_TOKEN \
# -e nodeID=1 \
# git.viaeon.com/admin/way-node:latest
#
# Supported env vars:
# apiHost / API_HOST → panel URL
# apiKey / API_KEY → server token
# nodeID / NODE_ID → node ID
# nodeType / NODE_TYPE → node type (optional)
# kernel / KERNEL_TYPE → singbox (default) or xray
# domain / DOMAIN → TLS domain (enables auto_tls)
# certFile / CERT_FILE → TLS cert path
# keyFile / KEY_FILE → TLS key path
# logLevel / LOG_LEVEL → log level
ENTRYPOINT ["way-node"]
CMD ["-c", "/etc/way-node/config.yml"]