InazumaV / V2bX

Mozilla Public License 2.0
363 stars 250 forks source link

我提供了类似 xray 的 docker-compose 部署方式 #22

Open shizeying opened 1 year ago

shizeying commented 1 year ago
# Build go
FROM golang:1.21-alpine AS builder
WORKDIR /app
ENV CGO_ENABLED=0
ENV version=v3.0.0
RUN  apk --update --no-cache add tzdata ca-certificates git
RUN  git clone https://github.com/InazumaV/V2bX.git . &&git checkout v3.0.0 && \
     go build -v -o V2bX -tags "sing xray with_reality_server with_quic" -trimpath -ldflags "-X 'github.com/InazumaV/V2bX/cmd.version=$version' -s -w -buildid="

# Release
FROM  alpine
# 安装必要的工具包
RUN  apk --update --no-cache add tzdata ca-certificates git \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN mkdir /etc/V2bX
COPY --from=builder /app/V2bX /usr/local/bin
COPY --from=builder /app/example /etc/V2bX
RUN  mv /etc/V2bX/config.json /etc/V2bX/config.json

ENTRYPOINT [ "V2bX", "server"]
~                               

提供的 yml

version: '3.8'
services:
  xrayr:
    build:
      context: ./
      dockerfile: Dockerfile
    volumes:
      - ./config:/etc/V2bX # 映射配置文件夹
    restart: always
    network_mode: host
shizeying commented 1 year ago

我觉得无需列出,上面已经写的很清楚,当你使用 docekr-compose 部署的时候,那么会触发自动编译.这本身并不冲突

alexallen1 commented 6 months ago

感谢分享~ 能否再做一个docker-compose ,https://github.com/wyx2685/V2bX-script 这家的~ 他有hy2和xray魔改支持