ngbs 3 年之前
父節點
當前提交
7c9a15fbb7
共有 2 個文件被更改,包括 32 次插入10 次删除
  1. 20 0
      x-ui/Dockerfile.builder
  2. 12 10
      x-ui/Dockerfile.latest

+ 20 - 0
x-ui/Dockerfile.builder

@@ -0,0 +1,20 @@
+# syntax=docker/dockerfile:1
+FROM golang:latest AS builder
+ADD https://github.com/XTLS/Xray-core/releases/download/v1.5.10/Xray-linux-64.zip /tmp
+WORKDIR /go/src
+RUN apt-get update && apt-get install -y --no-install-recommends -y unzip && \
+    git clone --depth 1 https://github.com/FranzKafkaYu/x-ui.git . && \
+    go build main.go && \
+    # export version=$(wget -qO- https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/'); \
+    # wget -P /tmp https://github.com/XTLS/Xray-core/releases/download/${version}/Xray-linux-64.zip; \
+    unzip /tmp/Xray-linux-64.zip -d /tmp; \
+    mv /tmp/xray /tmp/xray-linux-amd64; \
+    ls -la ./ && ls -la /tmp
+
+FROM debian:11-slim
+COPY --from=builder /go/src/main /usr/local/bin/x-ui
+COPY --from=builder /tmp/*.dat /tmp/xray-linux-amd64 /bin
+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/*
+VOLUME ["/etc/x-ui"]
+ENTRYPOINT ["/usr/local/bin/x-ui"]
+ENV PATH /usr/local/bin/x-ui:$PATH

+ 12 - 10
x-ui/Dockerfile.latest

@@ -1,20 +1,22 @@
 # syntax=docker/dockerfile:1
-FROM golang:latest AS builder
+FROM golang:alpine AS builder
+ADD https://github.com/FranzKafkaYu/x-ui/releases/download/0.3.3.16-0814/x-ui-linux-amd64.tar.gz /tmp
 ADD https://github.com/XTLS/Xray-core/releases/download/v1.5.10/Xray-linux-64.zip /tmp
-WORKDIR /go/src
-RUN apt-get update && apt-get install -y --no-install-recommends -y unzip && \
-    git clone --depth 1 https://github.com/FranzKafkaYu/x-ui.git . && \
-    go build main.go && \
-    # export version=$(wget -qO- https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/'); \
-    # wget -P /tmp https://github.com/XTLS/Xray-core/releases/download/${version}/Xray-linux-64.zip; \
+RUN
+    # export xui_version=$(wget -qO- https://api.github.com/repos/FranzKafkaYu/x-ui/releases/latest | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/'); \
+    # wget -P /tmp https://github.com/FranzKafkaYu/x-ui/releases/download/${xui_version}/x-ui-linux-amd64.tar.gz; \
+    # export xray_version=$(wget -qO- https://api.github.com/repos/XTLS/Xray-core/releases/latest | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/'); \
+    # wget -P /tmp https://github.com/XTLS/Xray-core/releases/download/${xray_version}/Xray-linux-64.zip; \
+    tar zxf /tmp/x-ui-linux-amd64.tar.gz -C /tmp --strip-components=1; \
+    rm -rf /tmp/bin; \
     unzip /tmp/Xray-linux-64.zip -d /tmp; \
     mv /tmp/xray /tmp/xray-linux-amd64; \
     ls -la ./ && ls -la /tmp
 
-FROM debian:11-slim
-COPY --from=builder /go/src/main /usr/local/bin/x-ui
+FROM alpine
+COPY --from=builder /tmp/x-ui /usr/local/bin/x-ui
 COPY --from=builder /tmp/*.dat /tmp/xray-linux-amd64 /bin
-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/*
+RUN apk --no-cache add ca-certificates tzdata
 VOLUME ["/etc/x-ui"]
 ENTRYPOINT ["/usr/local/bin/x-ui"]
 ENV PATH /usr/local/bin/x-ui:$PATH