Skip to content

Commit

Permalink
Change test dockerfile base to docker:24.0.4-cli-alpine3.18 rather …
Browse files Browse the repository at this point in the history
…than copying in, buildx would not work the other way.

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
  • Loading branch information
PromoFaux committed Jul 24, 2023
1 parent 3208c40 commit e5501ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
25 changes: 12 additions & 13 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
FROM python:3.10-alpine3.18
FROM docker:24.0.4-cli-alpine3.18

# Only works for docker CLIENT (bind mounted socket)
COPY --from=docker:24-cli /usr/local/bin/docker /usr/local/bin/

RUN apk add --no-cache \
curl \
&& pip3 install --no-cache-dir -U pip pipenv

COPY ./cmd.sh /usr/local/bin/
COPY --chmod=0755 ./cmd.sh /usr/local/bin/cmd.sh
COPY --chmod=0755 ./entrypoint.sh /usr/local/bin/entrypoint.sh
COPY Pipfile* /root/
WORKDIR /root

RUN pipenv install --system \
&& sed -i 's|/bin/sh|/bin/bash|g' /usr/local/lib/python3.10/site-packages/testinfra/backend/docker.py
RUN apk add --no-cache \
python3-dev \
py3-pip \
curl \
&& pip3 install --no-cache-dir -U pip pipenv \
&& pipenv install --system \
# Not 100% sure what this line does, but it's always been in the Dockerfile (aside from pointing at a different file)
# Tests fall over without it. Investigate later.
&& sed -i 's|/bin/sh|/bin/bash|g' /usr/lib/python3.11/site-packages/testinfra/backend/docker.py

RUN echo "set -ex && cmd.sh && \$@" > /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT entrypoint.sh
CMD cmd.sh
2 changes: 1 addition & 1 deletion test/cmd.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
set -eux

docker build ./src --tag pihole:${GIT_TAG} --no-cache
docker buildx build ./src --tag pihole:${GIT_TAG} --no-cache
docker images pihole:${GIT_TAG}

# auto-format the pytest code
Expand Down
1 change: 1 addition & 0 deletions test/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set -ex && cmd.sh && \$@

0 comments on commit e5501ea

Please sign in to comment.