feat: Adds entrypoint.sh script to docker to allow attaching to a shell inside the container.
All checks were successful
CI / Run Tests (push) Successful in 2m33s
Build docker images / docker (push) Successful in 6m49s

This commit is contained in:
2025-11-07 13:18:57 -05:00
parent 63012131d4
commit 15454e3686
2 changed files with 22 additions and 1 deletions

View File

@@ -55,6 +55,8 @@ RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && \
&& rm -r /var/lib/apt/lists/* && rm -r /var/lib/apt/lists/*
COPY --from=build /staging/hpa /usr/local/bin COPY --from=build /staging/hpa /usr/local/bin
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Setup volumes # Setup volumes
RUN mkdir /config && \ RUN mkdir /config && \
@@ -67,5 +69,5 @@ RUN mkdir /config && \
VOLUME /config /consults /playbook /template VOLUME /config /consults /playbook /template
ENTRYPOINT [ "/usr/local/bin/hpa" ] ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["--help"] CMD ["--help"]

19
docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Allows to attach to a shell inside the container, otherwise run the 'hpa' script
# with the given arguments.
#
while [[ $# -gt 0 ]]; do
if [[ $1 == "/bin/bash" ]] || [[ $1 == "bash" ]]; then
shift
/bin/bash "$@"
exit $?
elif [[ $1 == "/bin/sh" ]] || [[ $1 == "sh" ]]; then
shift
/bin/sh "$@"
exit $?
else
/usr/local/bin/hpa "$@"
fi
shift
done