Dockerfile.builder 1.1 KB

1234567891011121314151617181920
  1. # syntax=docker/dockerfile:1
  2. FROM golang:latest AS builder
  3. ADD https://github.com/XTLS/Xray-core/releases/download/v1.5.10/Xray-linux-64.zip /tmp
  4. WORKDIR /go/src
  5. RUN apt-get update && apt-get install -y --no-install-recommends -y unzip && \
  6. git clone --depth 1 https://github.com/FranzKafkaYu/x-ui.git . && \
  7. go build main.go && \
  8. # export version=$(wget -qO- https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/'); \
  9. # wget -P /tmp https://github.com/XTLS/Xray-core/releases/download/${version}/Xray-linux-64.zip; \
  10. unzip /tmp/Xray-linux-64.zip -d /tmp; \
  11. mv /tmp/xray /tmp/xray-linux-amd64; \
  12. ls -la ./ && ls -la /tmp
  13. FROM debian:11-slim
  14. COPY --from=builder /go/src/main /usr/local/bin/x-ui
  15. COPY --from=builder /tmp/*.dat /tmp/xray-linux-amd64 /bin
  16. RUN apt-get update && apt-get install -y --no-install-recommends -y ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  17. VOLUME ["/etc/x-ui"]
  18. ENTRYPOINT ["/usr/local/bin/x-ui"]
  19. ENV PATH /usr/local/bin/x-ui:$PATH