ngbs há 4 meses atrás
pai
commit
7fa3a44c30
1 ficheiros alterados com 16 adições e 10 exclusões
  1. 16 10
      chinadns-ng/Dockerfile

+ 16 - 10
chinadns-ng/Dockerfile

@@ -1,13 +1,19 @@
 # syntax=docker/dockerfile:1
-FROM golang:alpine AS builder
-WORKDIR /go
-RUN apk --no-cache --no-progress add git gcc make libc-dev linux-headers && \
-    git clone --depth 1 https://github.com/zfl9/chinadns-ng.git && \
-    cd /go/chinadns-ng && \
-    # make -j$(nproc) CFLAGS="-O3 -pipe" && \
-    make && make install
+FROM alpine:latest AS builder
+RUN apk add --no-cache \
+    git \
+    xz \
+    wget
+RUN wget https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz && \
+    tar xvf zig-linux-x86_64-0.10.1.tar.xz && \
+    mv zig-linux-x86_64-0.10.1 /zig && \
+    rm zig-linux-x86_64-0.10.1.tar.xz
+ENV PATH="/zig:${PATH}"
+RUN git clone https://github.com/zfl9/chinadns-ng && \
+    cd chinadns-ng && \
+    zig build -Dtarget=x86_64-linux-musl -Dcpu=x86_64_v3
 
-FROM playn/alpine
-COPY --from=builder --chown=0:0 /usr/local/bin/chinadns-ng /usr/local/bin/chinadns-ng
+FROM playn/alpine:latest
+COPY --from=builder /chinadns-ng/zig-out/bin/chinadns-ng /usr/local/bin/
 RUN apk --no-cache --no-progress add ipset nftables
-ENTRYPOINT [ "/usr/local/bin/chinadns-ng" ]
+ENTRYPOINT ["/usr/local/bin/chinadns-ng"]