2024-09-09 22:12:14 +02:00
|
|
|
FROM python:3.12.6-bookworm
|
2024-07-09 22:35:14 +02:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2024-07-30 10:40:16 +02:00
|
|
|
# nötig damit die ansible-tools gefunden werden
|
2024-07-30 11:11:07 +02:00
|
|
|
ENV PATH="$PATH:/home/ansible-dev/.local/bin"
|
2024-07-30 10:40:16 +02:00
|
|
|
|
2024-07-09 22:35:14 +02:00
|
|
|
# hadolint ignore=DL3008
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get -y --no-install-recommends install \
|
|
|
|
vim \
|
2024-07-25 23:13:58 +02:00
|
|
|
keychain \
|
2024-07-09 22:35:14 +02:00
|
|
|
tmux \
|
|
|
|
htop \
|
|
|
|
git \
|
|
|
|
dnsutils \
|
|
|
|
mc \
|
|
|
|
ca-certificates \
|
|
|
|
tree \
|
|
|
|
wget \
|
|
|
|
curl \
|
|
|
|
whois \
|
|
|
|
net-tools \
|
|
|
|
apt-transport-https \
|
|
|
|
moreutils \
|
|
|
|
acl \
|
|
|
|
ripgrep \
|
|
|
|
pwgen \
|
|
|
|
bc \
|
|
|
|
jq \
|
2024-07-30 10:34:53 +02:00
|
|
|
sudo \
|
2024-08-12 10:23:05 +02:00
|
|
|
sshpass \
|
2024-07-25 23:17:16 +02:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* requirements.txt requirements.yaml \
|
2024-07-09 22:35:14 +02:00
|
|
|
&& apt-get clean
|
2024-07-25 23:13:58 +02:00
|
|
|
|
2024-07-30 10:34:53 +02:00
|
|
|
# Update the package list, install sudo, create a non-root user, and grant password-less sudo permissions
|
|
|
|
# https://dev.to/izackv/running-a-docker-container-with-a-custom-non-root-user-syncing-host-and-container-permissions-26mb
|
|
|
|
# hadolint ignore=DL3008
|
2024-07-30 11:18:05 +02:00
|
|
|
RUN addgroup --gid 1000 ansible-dev && \
|
2024-07-30 11:21:23 +02:00
|
|
|
adduser --uid 1000 --gid 1000 --disabled-password --gecos "" ansible-dev && \
|
2024-07-30 11:11:07 +02:00
|
|
|
echo 'ansible-dev ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
2024-07-30 10:34:53 +02:00
|
|
|
|
|
|
|
# Set the non-root user as the default user
|
2024-07-30 11:11:07 +02:00
|
|
|
USER ansible-dev
|
2024-07-30 10:34:53 +02:00
|
|
|
|
2024-07-30 11:11:07 +02:00
|
|
|
WORKDIR /home/ansible-dev/
|
2024-07-30 10:34:53 +02:00
|
|
|
|
2024-07-30 14:29:21 +02:00
|
|
|
COPY --chown=ansible-dev:ansible-dev requirements.txt .
|
2024-07-30 10:34:53 +02:00
|
|
|
# hadolint ignore=DL3013
|
|
|
|
RUN python3 -m pip install --no-cache-dir --upgrade pip \
|
2024-07-30 14:26:57 +02:00
|
|
|
&& python3 -m pip install --no-cache-dir -r requirements.txt \
|
2024-07-30 14:20:26 +02:00
|
|
|
&& rm -rf requirements.txt
|
|
|
|
|
|
|
|
COPY --chown=ansible-dev:ansible-dev requirements.yaml .
|
|
|
|
RUN ansible-galaxy install -r requirements.yaml \
|
|
|
|
&& rm -rf requirements.yaml
|
2024-07-30 10:34:53 +02:00
|
|
|
|
2024-07-25 23:17:16 +02:00
|
|
|
# dotfiles, see: https://git.mgrote.net/mg/dotfiles/raw/branch/master/scripts/setup_minimal.sh
|
2024-07-25 23:18:06 +02:00
|
|
|
# hadolint ignore=DL3001
|
2024-07-25 23:17:16 +02:00
|
|
|
RUN git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim \
|
|
|
|
&& git clone https://git.mgrote.net/mg/dotfiles ~/dotfiles \
|
|
|
|
&& ln -s ~/dotfiles/.tmux.conf ~/.tmux.conf \
|
2024-07-29 16:07:11 +02:00
|
|
|
&& ln -s ~/dotfiles/.gitconfig ~/.gitconfig \
|
2024-07-25 23:17:16 +02:00
|
|
|
&& ln -s ~/dotfiles/.vimrc ~/.vimrc \
|
|
|
|
&& ln -s ~/dotfiles/vim/spell/ ~/.vim/ \
|
2024-07-25 23:20:57 +02:00
|
|
|
&& rm ~/.bashrc \
|
|
|
|
&& ln -s ~/dotfiles/.bash_extra ~/.bashrc \
|
2024-07-30 14:20:32 +02:00
|
|
|
&& vim +PluginInstall +qall
|
2024-07-29 15:59:43 +02:00
|
|
|
|
2024-07-30 20:30:11 +02:00
|
|
|
COPY --chown=ansible-dev:ansible-dev start_tmux.sh .
|
2024-07-30 11:11:07 +02:00
|
|
|
ENTRYPOINT ["/home/ansible-dev/start_tmux.sh"]
|