mirror of https://github.com/dnomd343/ClearDNS
dnomd343
3 years ago
2 changed files with 44 additions and 92 deletions
@ -1,12 +1,45 @@ |
|||
FROM alpine as asset |
|||
COPY ./asset.sh / |
|||
RUN apk --update add --no-cache curl wget && \ |
|||
sh /asset.sh |
|||
FROM alpine:3.15 |
|||
COPY . /tmp/ClearDNS |
|||
ENV OVERTURE_VERSION="v1.8" |
|||
ENV DNSPROXY_VERSION="v0.41.3" |
|||
ENV ADGUARD_VERSION="v0.107.5" |
|||
RUN \ |
|||
apk add git build-base make cmake glib-dev go npm nodejs yarn upx && \ |
|||
\ |
|||
mkdir /tmp/release/ && cd /tmp/ && \ |
|||
git clone https://github.com/shawn1m/overture.git && \ |
|||
git clone https://github.com/AdguardTeam/dnsproxy.git && \ |
|||
git clone https://github.com/AdguardTeam/AdGuardHome.git && \ |
|||
\ |
|||
cd /tmp/ClearDNS/ && mkdir ./build/ && \ |
|||
cd ./build/ && cmake -DCMAKE_BUILD_TYPE=Release .. && make && \ |
|||
mv ../bin/cleardns /tmp/release/ && \ |
|||
\ |
|||
cd /tmp/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 && \ |
|||
mv ./overture /tmp/release/ && \ |
|||
\ |
|||
cd /tmp/dnsproxy/ && git checkout $DNSPROXY_VERSION && \ |
|||
env CGO_ENABLED=0 go build -trimpath -ldflags "-X main.VersionString=$DNSPROXY_VERSION -s -w" && \ |
|||
mv ./dnsproxy /tmp/release/ && \ |
|||
\ |
|||
cd /tmp/AdGuardHome/ && git checkout $ADGUARD_VERSION && \ |
|||
make VERSION=$ADGUARD_VERSION && \ |
|||
mv ./AdGuardHome /tmp/release/ && \ |
|||
\ |
|||
cd /tmp/release/ && \ |
|||
strip * && upx -9 * |
|||
|
|||
FROM alpine |
|||
COPY ["./overture/", "./init.sh", "/etc/overture/"] |
|||
COPY --from=asset /tmp/asset/ /usr/bin/ |
|||
RUN mv /etc/overture/init.sh / && \ |
|||
mkdir -p /etc/cleardns && \ |
|||
sed -i '$i\0\t4\t*\t*\t*\t/etc/overture/update.sh' /var/spool/cron/crontabs/root |
|||
CMD ["sh","/init.sh"] |
|||
# |
|||
#FROM alpine as asset |
|||
#COPY ./asset.sh / |
|||
#RUN apk --update add --no-cache curl wget && \ |
|||
# sh /asset.sh |
|||
# |
|||
#FROM alpine |
|||
#COPY ["./overture/", "./init.sh", "/etc/overture/"] |
|||
#COPY --from=asset /tmp/asset/ /usr/bin/ |
|||
#RUN mv /etc/overture/init.sh / && \ |
|||
# mkdir -p /etc/cleardns && \ |
|||
# sed -i '$i\0\t4\t*\t*\t*\t/etc/overture/update.sh' /var/spool/cron/crontabs/root |
|||
#CMD ["sh","/init.sh"] |
|||
|
@ -1,81 +0,0 @@ |
|||
get_github_latest_version() { |
|||
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); |
|||
} |
|||
|
|||
get_architecture() { |
|||
case "$(uname -m)" in |
|||
'i386' | 'i686') |
|||
MACHINE='i386' |
|||
;; |
|||
'amd64' | 'x86_64') |
|||
MACHINE='amd64' |
|||
;; |
|||
'armv7' | 'armv7l') |
|||
MACHINE='arm' |
|||
;; |
|||
'armv8' | 'aarch64') |
|||
MACHINE='arm64' |
|||
;; |
|||
*) |
|||
echo "The architecture is not supported." |
|||
exit 1 |
|||
;; |
|||
esac |
|||
} |
|||
|
|||
ASSET_DIR="/tmp/asset" |
|||
PKG_DIR="$ASSET_DIR/pkg" |
|||
mkdir -p $PKG_DIR |
|||
|
|||
get_architecture |
|||
case "$MACHINE" in |
|||
'i386') |
|||
AGH_PKG_NAME="AdGuardHome_linux_386.tar.gz" |
|||
OVERTURE_FILE_NAME="overture-linux-386" |
|||
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
|||
DNSPROXY_FOLDER_NAME="linux-386" |
|||
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
|||
;; |
|||
'amd64') |
|||
AGH_PKG_NAME="AdGuardHome_linux_amd64.tar.gz" |
|||
OVERTURE_FILE_NAME="overture-linux-amd64" |
|||
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
|||
DNSPROXY_FOLDER_NAME="linux-amd64" |
|||
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
|||
;; |
|||
'arm') |
|||
AGH_PKG_NAME="AdGuardHome_linux_armv7.tar.gz" |
|||
OVERTURE_FILE_NAME="overture-linux-arm" |
|||
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
|||
DNSPROXY_FOLDER_NAME="linux-arm6" |
|||
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
|||
;; |
|||
'arm64') |
|||
AGH_PKG_NAME="AdGuardHome_linux_arm64.tar.gz" |
|||
OVERTURE_FILE_NAME="overture-linux-arm64" |
|||
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
|||
DNSPROXY_FOLDER_NAME="linux-arm64" |
|||
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
|||
;; |
|||
*) |
|||
exit 1 |
|||
;; |
|||
esac |
|||
|
|||
get_github_latest_version "AdguardTeam/AdGuardHome" |
|||
wget -P $PKG_DIR "https://github.com/AdguardTeam/AdGuardHome/releases/download/$VERSION/$AGH_PKG_NAME" |
|||
tar xf $PKG_DIR/$AGH_PKG_NAME -C $PKG_DIR |
|||
mv $PKG_DIR/AdGuardHome/AdGuardHome $ASSET_DIR/ |
|||
|
|||
get_github_latest_version "shawn1m/overture" |
|||
wget -P $PKG_DIR "https://github.com/shawn1m/overture/releases/download/$VERSION/$OVERTURE_PKG_NAME" |
|||
unzip $PKG_DIR/$OVERTURE_PKG_NAME -d $PKG_DIR |
|||
mv $PKG_DIR/$OVERTURE_FILE_NAME $ASSET_DIR/overture |
|||
|
|||
get_github_latest_version "AdguardTeam/dnsproxy" |
|||
DNSPROXY_PKG_NAME="$DNSPROXY_PKG_PREFIX$VERSION.tar.gz" |
|||
wget -P $PKG_DIR "https://github.com/AdguardTeam/dnsproxy/releases/download/$VERSION/$DNSPROXY_PKG_NAME" |
|||
tar xf $PKG_DIR/$DNSPROXY_PKG_NAME -C $PKG_DIR |
|||
mv $PKG_DIR/$DNSPROXY_FOLDER_NAME/dnsproxy $ASSET_DIR |
|||
|
|||
rm -rf $PKG_DIR |
Loading…
Reference in new issue