mirror of https://github.com/dnomd343/ClearDNS
dnomd343
3 years ago
1 changed files with 24 additions and 32 deletions
@ -1,64 +1,56 @@ |
|||||
FROM alpine:3.15.2 as build |
FROM golang:1.17.8-alpine3.15 AS asset |
||||
COPY . /tmp/ClearDNS |
COPY . /build/ClearDNS |
||||
ENV GO_VERSION="1.17.8" |
|
||||
ENV UPX_VERSION="3.96" |
ENV UPX_VERSION="3.96" |
||||
ENV OVERTURE_VERSION="v1.8" |
ENV OVERTURE_VERSION="v1.8" |
||||
ENV DNSPROXY_VERSION="v0.42.0" |
ENV DNSPROXY_VERSION="v0.42.0" |
||||
ENV ADGUARD_VERSION="v0.107.5" |
ENV ADGUARD_VERSION="v0.107.5" |
||||
RUN \ |
RUN \ |
||||
apk add git build-base bash make cmake glib-dev go npm nodejs yarn perl ucl-dev zlib-dev && \ |
apk add git build-base bash make cmake glib-dev npm nodejs yarn perl ucl-dev zlib-dev && \ |
||||
\ |
\ |
||||
wget https://dl.google.com/go/go${GO_VERSION}.src.tar.gz -P /tmp/ && \ |
mkdir /build/release/ && cd /build/ && \ |
||||
tar -C /usr/local/ -xf /tmp/go${GO_VERSION}.src.tar.gz && \ |
|
||||
cd /usr/local/go/src/ && ./make.bash && \ |
|
||||
apk del go && export PATH=$PATH:/usr/local/go/bin && \ |
|
||||
\ |
|
||||
mkdir /tmp/release/ && cd /tmp/ && \ |
|
||||
git clone https://github.com/shawn1m/overture.git && \ |
git clone https://github.com/shawn1m/overture.git && \ |
||||
git clone https://github.com/AdguardTeam/dnsproxy.git && \ |
git clone https://github.com/AdguardTeam/dnsproxy.git && \ |
||||
git clone https://github.com/AdguardTeam/AdGuardHome.git && \ |
git clone https://github.com/AdguardTeam/AdGuardHome.git && \ |
||||
wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz && \ |
wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-src.tar.xz && \ |
||||
\ |
\ |
||||
cd /tmp/ && tar xf upx-${UPX_VERSION}-src.tar.xz && \ |
cd /build/ && tar xf upx-${UPX_VERSION}-src.tar.xz && \ |
||||
cd upx-${UPX_VERSION}-src && make all && \ |
cd upx-${UPX_VERSION}-src && make all && \ |
||||
mv ./src/upx.out /usr/bin/upx && \ |
mv ./src/upx.out /usr/bin/upx && \ |
||||
\ |
\ |
||||
cd /tmp/ClearDNS/ && mkdir ./build/ && \ |
cd /build/ClearDNS/ && mkdir ./build/ && \ |
||||
cd ./build/ && cmake -DCMAKE_BUILD_TYPE=Release .. && make && \ |
cd ./build/ && cmake -DCMAKE_BUILD_TYPE=Release .. && make && \ |
||||
mv ../bin/cleardns /tmp/release/ && \ |
mv ../bin/cleardns /build/release/ && \ |
||||
\ |
\ |
||||
cd /tmp/overture/ && git checkout ${OVERTURE_VERSION} && \ |
cd /build/overture/ && git checkout ${OVERTURE_VERSION} && \ |
||||
env CGO_ENABLED=0 go build -o overture -trimpath -ldflags "-X main.version=${OVERTURE_VERSION} -s -w" ./main/main.go && \ |
env CGO_ENABLED=0 go build -o overture -trimpath -ldflags "-X main.version=${OVERTURE_VERSION} -s -w" ./main/main.go && \ |
||||
mv ./overture /tmp/release/ && \ |
mv ./overture /build/release/ && \ |
||||
\ |
\ |
||||
cd /tmp/dnsproxy/ && git checkout ${DNSPROXY_VERSION} && \ |
cd /build/dnsproxy/ && git checkout ${DNSPROXY_VERSION} && \ |
||||
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VersionString=${DNSPROXY_VERSION} -s -w" && \ |
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VersionString=${DNSPROXY_VERSION} -s -w" && \ |
||||
mv ./dnsproxy /tmp/release/ && \ |
mv ./dnsproxy /build/release/ && \ |
||||
\ |
\ |
||||
cd /tmp/AdGuardHome/ && git checkout ${ADGUARD_VERSION} && \ |
cd /build/AdGuardHome/ && git checkout ${ADGUARD_VERSION} && \ |
||||
make CHANNEL="release" VERSION=${ADGUARD_VERSION} && \ |
make CHANNEL="release" VERSION=${ADGUARD_VERSION} && \ |
||||
mv ./AdGuardHome /tmp/release/ && \ |
mv ./AdGuardHome /build/release/ && \ |
||||
\ |
\ |
||||
cd /tmp/release/ && \ |
cd /build/release/ && \ |
||||
strip cleardns && \ |
strip cleardns && \ |
||||
upx -9 AdGuardHome dnsproxy overture |
upx -9 AdGuardHome dnsproxy overture && \ |
||||
|
\ |
||||
FROM alpine:3.15.2 as asset |
cd /build/ && \ |
||||
COPY . /tmp/ClearDNS |
|
||||
COPY --from=build /tmp/release /tmp/release |
|
||||
RUN \ |
|
||||
wget https://res.dnomd343.top/Share/gfwlist/gfwlist.txt && \ |
wget https://res.dnomd343.top/Share/gfwlist/gfwlist.txt && \ |
||||
wget https://res.dnomd343.top/Share/chinalist/chinalist.txt && \ |
wget https://res.dnomd343.top/Share/chinalist/chinalist.txt && \ |
||||
wget https://res.dnomd343.top/Share/chinalist/china-ip.txt && \ |
wget https://res.dnomd343.top/Share/chinalist/china-ip.txt && \ |
||||
tar czf asset.tar.gz gfwlist.txt chinalist.txt china-ip.txt && \ |
tar czf asset.tar.gz gfwlist.txt chinalist.txt china-ip.txt && \ |
||||
mkdir -p /tmp/asset/etc/ && mkdir -p /tmp/asset/usr/ && \ |
\ |
||||
cp -r /tmp/ClearDNS/overture/ /tmp/asset/etc/ && \ |
mkdir -p /asset/etc/ && mkdir -p /asset/usr/ && \ |
||||
mv asset.tar.gz /tmp/asset/etc/overture/ && \ |
cp -r /build/ClearDNS/overture/ /asset/etc/ && \ |
||||
mv /tmp/release/ /tmp/asset/usr/bin/ && \ |
mv asset.tar.gz /asset/etc/overture/ && \ |
||||
mv /tmp/ClearDNS/load.sh /tmp/asset/usr/bin/load |
mv /build/release/ /asset/usr/bin/ && \ |
||||
|
mv /build/ClearDNS/load.sh /asset/usr/bin/load |
||||
|
|
||||
FROM alpine:3.15.2 |
FROM alpine:3.15.2 |
||||
COPY --from=asset /tmp/asset / |
COPY --from=asset /asset / |
||||
RUN apk add --no-cache ca-certificates glib iptables ip6tables && \ |
RUN apk add --no-cache ca-certificates glib iptables ip6tables && \ |
||||
echo -e "0\t4\t*\t*\t*\t/etc/overture/update.sh" > /var/spool/cron/crontabs/root |
echo -e "0\t4\t*\t*\t*\t/etc/overture/update.sh" > /var/spool/cron/crontabs/root |
||||
ENTRYPOINT ["cleardns"] |
ENTRYPOINT ["cleardns"] |
||||
|
Loading…
Reference in new issue