Files
pi-hole-mirror/test/_debian_12.Dockerfile
Adam Warner 551b6516d1 test: bake BATS libraries into test images at build time
Add ARG declarations and a build-time RUN step to all Dockerfiles so
bats-core, bats-support, bats-assert, bats-mock, and bats-file are cloned
at image build time rather than at container runtime.  Library versions are
defined once in run.sh and passed down via --build-arg

Add .dockerignore to exclude any locally-cached test/libs/ directory from
the build context, preventing 'destination already exists' failures when
the directory exists from a previous local test run.

Remove the legacy commented-out sed stub command from all Dockerfiles

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-05-21 19:30:20 +01:00

27 lines
1.2 KiB
Docker

FROM buildpack-deps:bookworm-scm
ENV GITDIR=/etc/.pihole
ENV SCRIPTDIR=/opt/pihole
RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
ADD . $GITDIR
RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $GITDIR/advanced/Scripts/COL_TABLE $SCRIPTDIR/
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \
chmod +x $SCRIPTDIR/*
ARG BATS_CORE_VER
ARG BATS_SUPPORT_VER
ARG BATS_ASSERT_VER
ARG BATS_MOCK_VER
ARG BATS_FILE_VER
RUN git clone --depth=1 --single-branch --branch "${BATS_CORE_VER}" https://github.com/bats-core/bats-core $GITDIR/test/libs/bats && \
git clone --depth=1 --single-branch --branch "${BATS_SUPPORT_VER}" https://github.com/bats-core/bats-support $GITDIR/test/libs/bats-support && \
git clone --depth=1 --single-branch --branch "${BATS_ASSERT_VER}" https://github.com/bats-core/bats-assert $GITDIR/test/libs/bats-assert && \
git clone --depth=1 --single-branch --branch "${BATS_MOCK_VER}" https://github.com/jasonkarns/bats-mock $GITDIR/test/libs/bats-mock && \
git clone --depth=1 --single-branch --branch "${BATS_FILE_VER}" https://github.com/bats-core/bats-file $GITDIR/test/libs/bats-file
ENV SKIP_INSTALL=true