Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix arm64 arch. use copy --chmod. reduce number of layers. #1393

Merged
merged 2 commits into from
Jul 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 25 additions & 30 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
ARG CONTAINER="3.18"
FROM alpine:${CONTAINER}
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope

ARG TARGETPLATFORM
ARG WEB_BRANCH="development-v6"
ARG CORE_BRANCH="development-v6"
ARG FTL_BRANCH="development-v6"
ARG PIHOLE_DOCKER_TAG="unknown"

ENV DNSMASQ_USER=pihole
ENV FTL_CMD=no-daemon

RUN apk add --no-cache \
git \
Expand All @@ -18,34 +26,27 @@ RUN apk add --no-cache \
jq \
coreutils \
procps \
ncurses

ARG PIHOLE_DOCKER_TAG="unknown"
RUN echo "${PIHOLE_DOCKER_TAG}" > /pihole.docker.tag
ncurses \
binutils

ARG WEB_BRANCH="development-v6"
ARG CORE_BRANCH="development-v6"
ARG FTL_BRANCH="development-v6"
ADD https://ftl.pi-hole.net/macvendor.db /macvendor.db
COPY crontab.txt /crontab.txt

# download a the main repos from github
RUN git clone --depth 1 --single-branch --branch ${WEB_BRANCH} https://github.com/pi-hole/AdminLTE.git /var/www/html/admin && \
git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/pi-hole/pi-hole.git /etc/.pihole

# Download the latest version of pihole-FTL for alpine:
# Probably need this to be built for different FTLARCHs
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then FTLARCH=amd64; \
git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/pi-hole/pi-hole.git /etc/.pihole ;\
# Download the latest version of pihole-FTL for alpine:
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then FTLARCH=amd64; \
elif [ "$TARGETPLATFORM" = "linux/386" ]; then FTLARCH=386; \
elif [ "$TARGETPLATFORM" = "linux/arm/v6" ]; then FTLARCH=armv6; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then FTLARCH=armv7; \
elif [ "$TARGETPLATFORM" = "linux/arm64/v8" ]; then FTLARCH=armv64; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then FTLARCH=arm64; \
elif [ "$TARGETPLATFORM" = "linux/riscv64" ]; then FTLARCH=riscv64; \
else FTLARCH=amd64; fi \
&& curl -sSL "https://ftl.pi-hole.net/${FTL_BRANCH}/pihole-FTL-${FTLARCH}" -o /usr/bin/pihole-FTL && \
chmod +x /usr/bin/pihole-FTL


ADD https://ftl.pi-hole.net/macvendor.db /macvendor.db
COPY crontab.txt /crontab.txt
&& echo "Arch: ${TARGETPLATFORM}, FTLARCH: ${FTLARCH}" \
&& curl -sSL "https://ftl.pi-hole.net/${FTL_BRANCH}/pihole-FTL-${FTLARCH}" -o /usr/bin/pihole-FTL \
&& chmod +x /usr/bin/pihole-FTL \
&& readelf -h /usr/bin/pihole-FTL || cat /usr/bin/pihole-FTL

RUN cd /etc/.pihole && \
install -Dm755 -d /opt/pihole && \
Expand All @@ -56,18 +57,12 @@ RUN cd /etc/.pihole && \
install -Dm755 -t /usr/local/bin pihole && \
install -Dm644 ./advanced/bash-completion/pihole /etc/bash_completion.d/pihole && \
install -T -m 0755 ./advanced/Templates/pihole-FTL-prestart.sh /opt/pihole/pihole-FTL-prestart.sh && \
install -T -m 0755 ./advanced/Templates/pihole-FTL-poststop.sh /opt/pihole/pihole-FTL-poststop.sh


ENV DNSMASQ_USER=pihole
ENV FTL_CMD=no-daemon
RUN addgroup -S pihole && adduser -S pihole -G pihole
# RUN groupadd pihole && useradd -r --no-user-group -g pihole -s /usr/sbin/nologin pihole

COPY bash_functions.sh /usr/bin/bash_functions.sh
COPY start.sh /usr/bin/start.sh
install -T -m 0755 ./advanced/Templates/pihole-FTL-poststop.sh /opt/pihole/pihole-FTL-poststop.sh && \
addgroup -S pihole && adduser -S pihole -G pihole && \
echo "${PIHOLE_DOCKER_TAG}" > /pihole.docker.tag

RUN chmod +x /usr/bin/start.sh
COPY --chmod=0755 bash_functions.sh /usr/bin/bash_functions.sh
COPY --chmod=0755 start.sh /usr/bin/start.sh

HEALTHCHECK CMD dig +short +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1

Expand Down