From f7f3ac5dc7c174f0bd5192905f66a432d5f17a7e Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Fri, 7 Nov 2025 15:16:05 -0500 Subject: [PATCH] feat: Updates Dockerfile, WIP --- docker/Dockerfile | 24 ++++++++++++++---------- docker/entrypoint.sh | 7 +++++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ffd7155..dcae788 100755 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -40,6 +40,12 @@ RUN --mount=type=cache,target=/build/.build \ # ============================================================ 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 && \ apt-get -q update && \ apt-get -q dist-upgrade -y && \ @@ -47,27 +53,25 @@ RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && \ ansible \ curl \ imagemagick \ + just \ pandoc \ texlive \ libjemalloc2 \ libcurl4 \ tzdata \ + vim \ && rm -r /var/lib/apt/lists/* +# Install the hpa executable. COPY --from=build /staging/hpa /usr/local/bin + +# Install the entrypoint script and make execuatable. COPY docker/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -# Setup volumes -RUN mkdir /config && \ - mkdir /consults && \ - 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 +# Set workdir and volume mounts. +WORKDIR /root +VOLUME /root ENTRYPOINT [ "/entrypoint.sh" ] CMD ["--help"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 2d7dad8..587cf3d 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Allows to attach to a shell inside the container, otherwise run the 'hpa' script -# with the given arguments. +# Allows to attach to a shell inside the container, or run ansbile commands, +# otherwise run the 'hpa' script with the given arguments. # while [[ $# -gt 0 ]]; do if [[ $1 == "/bin/bash" ]] || [[ $1 == "bash" ]]; then @@ -12,6 +12,9 @@ while [[ $# -gt 0 ]]; do shift /bin/sh "$@" exit $? + elif [[ $1 =~ ^ansible ]]; then + exec "$@" + exit $? else /usr/local/bin/hpa "$@" fi