|
@ -1,6 +1,6 @@ |
|
|
ARG ALPINE="alpine:3.17" |
|
|
ARG ALPINE="alpine:3.17" |
|
|
ARG RUST="rust:1.67-alpine3.17" |
|
|
ARG RUST="rust:1.67-alpine3.17" |
|
|
ARG GOLANG="golang:1.18-alpine3.16" |
|
|
ARG GOLANG="golang:1.19-alpine3.17" |
|
|
|
|
|
|
|
|
FROM ${ALPINE} AS upx |
|
|
FROM ${ALPINE} AS upx |
|
|
RUN apk add build-base cmake |
|
|
RUN apk add build-base cmake |
|
@ -11,32 +11,47 @@ RUN make UPX_CMAKE_CONFIG_FLAGS=-DCMAKE_EXE_LINKER_FLAGS=-static |
|
|
WORKDIR ./build/release/ |
|
|
WORKDIR ./build/release/ |
|
|
RUN strip upx && mv upx /tmp/ |
|
|
RUN strip upx && mv upx /tmp/ |
|
|
|
|
|
|
|
|
FROM ${GOLANG} AS adguard |
|
|
FROM ${GOLANG} AS dnsproxy |
|
|
ENV ADGUARD="0.107.20" |
|
|
ENV DNSPROXY="0.48.0" |
|
|
RUN apk add git make npm yarn |
|
|
RUN wget https://github.com/AdguardTeam/dnsproxy/archive/refs/tags/v${DNSPROXY}.tar.gz && tar xf v${DNSPROXY}.tar.gz |
|
|
RUN git clone https://github.com/AdguardTeam/AdGuardHome.git -b v${ADGUARD} --depth=1 |
|
|
WORKDIR ./dnsproxy-${DNSPROXY}/ |
|
|
WORKDIR ./AdGuardHome/ |
|
|
RUN go get |
|
|
RUN make js-deps |
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VersionString=${DNSPROXY} -s -w" && mv dnsproxy /tmp/ |
|
|
RUN make js-build |
|
|
|
|
|
RUN make CHANNEL="release" VERBOSE=1 go-build && mv AdGuardHome /tmp/ |
|
|
|
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
RUN upx -9 /tmp/AdGuardHome |
|
|
RUN upx -9 /tmp/dnsproxy |
|
|
|
|
|
|
|
|
FROM ${GOLANG} AS overture |
|
|
FROM ${GOLANG} AS overture |
|
|
ENV OVERTURE="1.8" |
|
|
ENV OVERTURE="1.8" |
|
|
RUN wget https://github.com/shawn1m/overture/archive/refs/tags/v${OVERTURE}.tar.gz && tar xf v${OVERTURE}.tar.gz |
|
|
RUN wget https://github.com/shawn1m/overture/archive/refs/tags/v${OVERTURE}.tar.gz && tar xf v${OVERTURE}.tar.gz |
|
|
WORKDIR ./overture-${OVERTURE}/main/ |
|
|
WORKDIR ./overture-${OVERTURE}/main/ |
|
|
|
|
|
RUN go get |
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=v${OVERTURE} -s -w" && mv main /tmp/overture |
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=v${OVERTURE} -s -w" && mv main /tmp/overture |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
RUN upx -9 /tmp/overture |
|
|
RUN upx -9 /tmp/overture |
|
|
|
|
|
|
|
|
FROM ${GOLANG} AS dnsproxy |
|
|
FROM ${ALPINE} AS adguard-src |
|
|
ENV DNSPROXY="0.46.4" |
|
|
RUN apk add git |
|
|
RUN wget https://github.com/AdguardTeam/dnsproxy/archive/refs/tags/v${DNSPROXY}.tar.gz && tar xf v${DNSPROXY}.tar.gz |
|
|
ENV ADGUARD="0.107.25" |
|
|
WORKDIR ./dnsproxy-${DNSPROXY}/ |
|
|
RUN git clone https://github.com/AdguardTeam/AdGuardHome.git -b v${ADGUARD} --depth=1 |
|
|
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.VersionString=${DNSPROXY} -s -w" && mv dnsproxy /tmp/ |
|
|
|
|
|
|
|
|
FROM ${ALPINE} AS adguard-web |
|
|
|
|
|
RUN apk add make npm |
|
|
|
|
|
COPY --from=adguard-src /AdGuardHome/ /AdGuardHome/ |
|
|
|
|
|
WORKDIR /AdGuardHome/ |
|
|
|
|
|
RUN make js-deps |
|
|
|
|
|
# TODO: for node18, remove the OpenSSL compatibility option after AdGuardHome project upgrade |
|
|
|
|
|
RUN env NODE_OPTIONS="--openssl-legacy-provider" make js-build |
|
|
|
|
|
RUN mv ./build/static/ /tmp/ |
|
|
|
|
|
|
|
|
|
|
|
FROM ${GOLANG} AS adguard |
|
|
|
|
|
RUN apk add git make |
|
|
|
|
|
COPY --from=adguard-src /AdGuardHome/ /AdGuardHome/ |
|
|
|
|
|
WORKDIR /AdGuardHome/ |
|
|
|
|
|
RUN go get |
|
|
|
|
|
COPY --from=adguard-web /tmp/static/ ./build/static/ |
|
|
|
|
|
RUN make CHANNEL="release" VERBOSE=1 go-build && mv AdGuardHome /tmp/ |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
RUN upx -9 /tmp/dnsproxy |
|
|
RUN upx -9 /tmp/AdGuardHome |
|
|
|
|
|
|
|
|
FROM ${RUST} AS rust-mods |
|
|
FROM ${RUST} AS rust-mods |
|
|
RUN apk add libc-dev openssl-dev |
|
|
RUN apk add libc-dev openssl-dev |
|
@ -53,8 +68,7 @@ COPY --from=rust-mods /tmp/libto_json.a /cleardns/src/target/release/ |
|
|
WORKDIR /cleardns/bin/ |
|
|
WORKDIR /cleardns/bin/ |
|
|
RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static .. && make && mv cleardns /tmp/ |
|
|
RUN cmake -DCMAKE_EXE_LINKER_FLAGS=-static .. && make && mv cleardns /tmp/ |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
COPY --from=upx /tmp/upx /usr/bin/ |
|
|
WORKDIR /tmp/ |
|
|
RUN strip /tmp/cleardns && upx -9 /tmp/cleardns |
|
|
RUN strip cleardns && upx -9 cleardns |
|
|
|
|
|
|
|
|
|
|
|
FROM ${ALPINE} AS build |
|
|
FROM ${ALPINE} AS build |
|
|
RUN apk add xz |
|
|
RUN apk add xz |
|
@ -63,10 +77,10 @@ RUN wget https://res.dnomd343.top/Share/cleardns/gfwlist.txt.xz && \ |
|
|
wget https://res.dnomd343.top/Share/cleardns/china-ip.txt.xz && \ |
|
|
wget https://res.dnomd343.top/Share/cleardns/china-ip.txt.xz && \ |
|
|
wget https://res.dnomd343.top/Share/cleardns/chinalist.txt.xz && \ |
|
|
wget https://res.dnomd343.top/Share/cleardns/chinalist.txt.xz && \ |
|
|
xz -d *.xz && tar cJf assets.tar.xz *.txt && rm *.txt |
|
|
xz -d *.xz && tar cJf assets.tar.xz *.txt && rm *.txt |
|
|
COPY --from=adguard /tmp/AdGuardHome /release/usr/bin/ |
|
|
|
|
|
COPY --from=overture /tmp/overture /release/usr/bin/ |
|
|
|
|
|
COPY --from=dnsproxy /tmp/dnsproxy /release/usr/bin/ |
|
|
|
|
|
COPY --from=cleardns /tmp/cleardns /release/usr/bin/ |
|
|
COPY --from=cleardns /tmp/cleardns /release/usr/bin/ |
|
|
|
|
|
COPY --from=dnsproxy /tmp/dnsproxy /release/usr/bin/ |
|
|
|
|
|
COPY --from=overture /tmp/overture /release/usr/bin/ |
|
|
|
|
|
COPY --from=adguard /tmp/AdGuardHome /release/usr/bin/ |
|
|
|
|
|
|
|
|
FROM ${ALPINE} |
|
|
FROM ${ALPINE} |
|
|
COPY --from=build /release/ / |
|
|
COPY --from=build /release/ / |
|
|