File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,11 +61,25 @@ COPY crontab.txt /crontab.txt
6161ADD --chmod=0755 https://raw.githubusercontent.com/${PADD_FORK}/PADD/${PADD_BRANCH}/padd.sh /usr/local/bin/padd
6262
6363# download a the main repos from github
64- # if the branch is master we reset to the latest tag as sometimes the master branch contains meta changes that have not been tagged.
65- RUN git clone --depth 5 --single-branch --branch ${WEB_BRANCH} https://github.com/${WEB_FORK}/web.git /var/www/html/admin && \
66- if [ "${WEB_BRANCH}" = "master" ]; then cd /var/www/html/admin && git reset --hard "$(git describe --tags --abbrev=0)" ; fi && \
67- git clone --depth 5 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole && \
68- if [ "${CORE_BRANCH}" = "master" ]; then cd /etc/.pihole && git reset --hard "$(git describe --tags --abbrev=0)" ; fi
64+ # if the branch is master we clone the latest tag as sometimes the master branch contains meta changes that have not been tagged
65+ # (we need to create a new "master" branch to avoid the "detached HEAD" state for the version check to work correctly)
66+
67+ RUN clone_repo() { \
68+ FORK="$1" ; \
69+ REPO="$2" ; \
70+ BRANCH="$3" ; \
71+ DEST="$4" ; \
72+ CLONE_BRANCH="$BRANCH" ; \
73+ if [ "$BRANCH" = "master" ]; then \
74+ CLONE_BRANCH=$(curl -s https://api.github.com/repos/${FORK}/${REPO}/releases/latest | jq -r .tag_name); \
75+ fi; \
76+ git clone --branch "$CLONE_BRANCH" --single-branch --depth 1 "https://github.com/${FORK}/${REPO}.git" "$DEST" ; \
77+ cd "$DEST" ; \
78+ if [ "$BRANCH" = "master" ]; then git checkout -b master; fi; \
79+ }; \
80+ clone_repo "${WEB_FORK}" "web" "${WEB_BRANCH}" "/var/www/html/admin" ; \
81+ clone_repo "${CORE_FORK}" "pi-hole" "${CORE_BRANCH}" "/etc/.pihole"
82+
6983
7084RUN cd /etc/.pihole && \
7185 install -Dm755 -d /opt/pihole && \
You can’t perform that action at this time.
0 commit comments