Compare commits
5 Commits
63012131d4
...
0.1.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
8ee4e436aa
|
|||
|
064976ed6e
|
|||
|
45a1520a2b
|
|||
|
f7f3ac5dc7
|
|||
|
15454e3686
|
@@ -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 && \
|
||||
@@ -49,23 +55,23 @@ RUN export DEBIAN_FRONTEND=nointeractive DEBCONF_NOINTERACTIVE_SEEN=true && \
|
||||
imagemagick \
|
||||
pandoc \
|
||||
texlive \
|
||||
texlive-xetex \
|
||||
libjemalloc2 \
|
||||
libcurl4 \
|
||||
tzdata \
|
||||
vim \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
# Install the hpa executable.
|
||||
COPY --from=build /staging/hpa /usr/local/bin
|
||||
|
||||
# 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
|
||||
# Install the entrypoint script and make execuatable.
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh && mkdir /root/project
|
||||
|
||||
VOLUME /config /consults /playbook /template
|
||||
# Set workdir and volume mounts.
|
||||
WORKDIR /root/project
|
||||
VOLUME /root/project
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/hpa" ]
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
CMD ["--help"]
|
||||
|
||||
27
docker/entrypoint.sh
Normal file
27
docker/entrypoint.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -a args
|
||||
|
||||
# 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
|
||||
shift
|
||||
/bin/bash "$@"
|
||||
exit $?
|
||||
elif [[ $1 == "/bin/sh" ]] || [[ $1 == "sh" ]]; then
|
||||
shift
|
||||
/bin/sh "$@"
|
||||
exit $?
|
||||
elif [[ $1 =~ ^ansible ]]; then
|
||||
exec "$@"
|
||||
exit $?
|
||||
else
|
||||
args+=("$1")
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
# If we made it here then run the hpa script.
|
||||
/usr/local/bin/hpa "${args[@]}"
|
||||
Reference in New Issue
Block a user