feat: Updates Dockerfile, WIP
All checks were successful
CI / Run Tests (push) Successful in 1m27s
Build docker images / docker (push) Successful in 6m45s

This commit is contained in:
2025-11-07 15:16:05 -05:00
parent 15454e3686
commit f7f3ac5dc7
2 changed files with 19 additions and 12 deletions

View File

@@ -40,6 +40,12 @@ RUN --mount=type=cache,target=/build/.build \
# ============================================================ # ============================================================
FROM docker.io/ubuntu:noble FROM docker.io/ubuntu:noble
# Update base image and install needed packages.
#
# NOTE: NB: Installs vim as minimal text editor to use inside the container, bc
# when I mount my home directory / use my neovim config it requires
# neovim v11+, but generally only going to edit ansible vault files
# inside the container.
RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && \ RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && \
apt-get -q update && \ apt-get -q update && \
apt-get -q dist-upgrade -y && \ apt-get -q dist-upgrade -y && \
@@ -47,27 +53,25 @@ RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && \
ansible \ ansible \
curl \ curl \
imagemagick \ imagemagick \
just \
pandoc \ pandoc \
texlive \ texlive \
libjemalloc2 \ libjemalloc2 \
libcurl4 \ libcurl4 \
tzdata \ tzdata \
vim \
&& rm -r /var/lib/apt/lists/* && rm -r /var/lib/apt/lists/*
# Install the hpa executable.
COPY --from=build /staging/hpa /usr/local/bin COPY --from=build /staging/hpa /usr/local/bin
# Install the entrypoint script and make execuatable.
COPY docker/entrypoint.sh /entrypoint.sh COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
# Setup volumes # Set workdir and volume mounts.
RUN mkdir /config && \ WORKDIR /root
mkdir /consults && \ VOLUME /root
mkdir /playbook && \
mkdir /template && \
mkdir -p /root/.local/share/hpa && \
ln -sfv /config /root/.config && \
ln -sfv /playbook /root/.local/share/hpa/playbook
VOLUME /config /consults /playbook /template
ENTRYPOINT [ "/entrypoint.sh" ] ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["--help"] CMD ["--help"]

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Allows to attach to a shell inside the container, otherwise run the 'hpa' script # Allows to attach to a shell inside the container, or run ansbile commands,
# with the given arguments. # otherwise run the 'hpa' script with the given arguments.
# #
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
if [[ $1 == "/bin/bash" ]] || [[ $1 == "bash" ]]; then if [[ $1 == "/bin/bash" ]] || [[ $1 == "bash" ]]; then
@@ -12,6 +12,9 @@ while [[ $# -gt 0 ]]; do
shift shift
/bin/sh "$@" /bin/sh "$@"
exit $? exit $?
elif [[ $1 =~ ^ansible ]]; then
exec "$@"
exit $?
else else
/usr/local/bin/hpa "$@" /usr/local/bin/hpa "$@"
fi fi