ansible-devspace/Dockerfile
Michael Grote a739e46ec7
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/build Pipeline failed
remove unused file
2024-07-30 20:22:38 +02:00

83 lines
2.5 KiB
Docker

FROM python:3.12.4-bookworm
ENV DEBIAN_FRONTEND=noninteractive
# nötig damit die ansible-tools gefunden werden
ENV PATH="$PATH:/home/ansible-dev/.local/bin"
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
vim \
figlet \
lolcat \
keychain \
tmux \
htop \
git \
dnsutils \
mc \
ca-certificates \
tree \
wget \
curl \
whois \
net-tools \
apt-transport-https \
moreutils \
acl \
ripgrep \
pwgen \
bc \
jq \
sudo \
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* requirements.txt requirements.yaml \
&& apt-get clean
# 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
RUN addgroup --gid 1000 ansible-dev && \
adduser --uid 1000 --gid 1000 --disabled-password --gecos "" ansible-dev && \
echo 'ansible-dev ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Set the non-root user as the default user
USER ansible-dev
WORKDIR /home/ansible-dev/
COPY --chown=ansible-dev:ansible-dev start_tmux.sh .
COPY --chown=ansible-dev:ansible-dev requirements.txt .
# hadolint ignore=DL3013
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& python3 -m pip install --no-cache-dir -r requirements.txt \
&& rm -rf requirements.txt
COPY --chown=ansible-dev:ansible-dev requirements.yaml .
RUN ansible-galaxy install -r requirements.yaml \
&& rm -rf requirements.yaml
# dotfiles, see: https://git.mgrote.net/mg/dotfiles/raw/branch/master/scripts/setup_minimal.sh
# hadolint ignore=DL3001
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 \
&& ln -s ~/dotfiles/.gitconfig ~/.gitconfig \
&& ln -s ~/dotfiles/.vimrc ~/.vimrc \
&& ln -s ~/dotfiles/vim/spell/ ~/.vim/ \
&& rm ~/.bashrc \
&& ln -s ~/dotfiles/.bash_extra ~/.bashrc \
&& vim +PluginInstall +qall
# setup motd
# hadolint ignore=DL3001,DL4006,SC2086
RUN vim --version | head -1 > /etc/motd \
&& ansible --version | head -1 >> /etc/motd \
&& git -v >> /etc/motd \
&& echo "" >> /etc/motd \
&& echo $CI_COMMIT_BRANCH >> /etc/motd \
&& echo $CI_REPO_URL >> /etc/motd \
&& echo "" >> /etc/motd \
&& echo "ansible-devspace" | figlet -l -w 100 | /usr/games/lolcat >> /etc/motd
ENTRYPOINT ["/home/ansible-dev/start_tmux.sh"]