feat: Updates Dockerfile, WIP
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user