Dockerfile 939 B

1234567891011121314151617181920
  1. # syntax=docker/dockerfile:1
  2. FROM golang:alpine 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 apk --no-cache add git gcc g++ && \
  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 alpine
  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 apk --no-cache add ca-certificates tzdata
  17. VOLUME ["/etc/x-ui"]
  18. ENTRYPOINT ["/usr/local/bin/x-ui"]
  19. ENV PATH /usr/local/bin/x-ui:$PATH