@@ -61,11 +61,22 @@ 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 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+ RUN if [ "${WEB_BRANCH}" = "master" ]; then \
67+ LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/${WEB_FORK}/web.git | tail -n1 | sed 's/.*\/ //; s/\^ {}//' ) && \
68+ git clone --branch ${LATEST_TAG} --single-branch --depth 1 https://github.com/${WEB_FORK}/web.git /var/www/html/admin && \
69+ cd /var/www/html/admin && \
70+ git checkout -b master; \
71+ else git clone --depth 1 --single-branch --branch ${WEB_BRANCH} https://github.com/${WEB_FORK}/web.git /var/www/html/admin; fi
72+
73+ RUN if [ "${CORE_BRANCH}" = "master" ]; then \
74+ LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/${CORE_FORK}/pi-hole.git | tail -n1 | sed 's/.*\/ //; s/\^ {}//' ) && \
75+ git clone --branch ${LATEST_TAG} --single-branch --depth 1 https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole && \
76+ cd /etc/.pihole && \
77+ git checkout -b master; \
78+ else git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole; fi
79+
6980
7081RUN cd /etc/.pihole && \
7182 install -Dm755 -d /opt/pihole && \
0 commit comments