fix linter error again and move apt-get to top
This commit is contained in:
parent
b45e6609f6
commit
25033e8520
1 changed files with 26 additions and 27 deletions
53
Dockerfile
53
Dockerfile
|
@ -2,33 +2,6 @@ FROM python:3.12.4-bookworm
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# 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 apt-get update && \
|
|
||||||
apt-get install -y sudo && \
|
|
||||||
addgroup --gid 2000 nonroot && \
|
|
||||||
adduser --uid 2000 --gid 2000 --disabled-password --gecos "" ansible-user && \
|
|
||||||
echo 'ansible-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* \
|
|
||||||
&& apt-get clean
|
|
||||||
|
|
||||||
# Set the non-root user as the default user
|
|
||||||
USER ansible-user
|
|
||||||
|
|
||||||
WORKDIR /home/ansible-user/
|
|
||||||
|
|
||||||
COPY --chown=ansible-user:ansible-user requirements.txt .
|
|
||||||
COPY --chown=ansible-user:ansible-user requirements.yaml .
|
|
||||||
COPY --chown=ansible-user:ansible-user start_tmux.sh .
|
|
||||||
COPY --chown=ansible-user:ansible-user version.sh .
|
|
||||||
|
|
||||||
# hadolint ignore=DL3013
|
|
||||||
RUN python3 -m pip install --no-cache-dir --upgrade pip \
|
|
||||||
&& python3 -m pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
RUN ansible-galaxy install -r requirements.yaml --roles-path=/ansible/roles
|
|
||||||
|
|
||||||
# hadolint ignore=DL3008
|
# hadolint ignore=DL3008
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get -y --no-install-recommends install \
|
&& apt-get -y --no-install-recommends install \
|
||||||
|
@ -54,9 +27,35 @@ RUN apt-get update \
|
||||||
pwgen \
|
pwgen \
|
||||||
bc \
|
bc \
|
||||||
jq \
|
jq \
|
||||||
|
sudo \
|
||||||
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* requirements.txt requirements.yaml \
|
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* requirements.txt requirements.yaml \
|
||||||
&& apt-get clean
|
&& 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 2000 nonroot && \
|
||||||
|
adduser --uid 2000 --gid 2000 --disabled-password --gecos "" ansible-user && \
|
||||||
|
echo 'ansible-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||||
|
|
||||||
|
# Set the non-root user as the default user
|
||||||
|
USER ansible-user
|
||||||
|
|
||||||
|
WORKDIR /home/ansible-user/
|
||||||
|
|
||||||
|
COPY --chown=ansible-user:ansible-user requirements.txt .
|
||||||
|
COPY --chown=ansible-user:ansible-user requirements.yaml .
|
||||||
|
COPY --chown=ansible-user:ansible-user start_tmux.sh .
|
||||||
|
COPY --chown=ansible-user:ansible-user version.sh .
|
||||||
|
|
||||||
|
# hadolint ignore=DL3013
|
||||||
|
RUN python3 -m pip install --no-cache-dir --upgrade pip \
|
||||||
|
&& python3 -m pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
RUN ansible-galaxy install -r requirements.yaml --roles-path=/ansible/roles
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# dotfiles, see: https://git.mgrote.net/mg/dotfiles/raw/branch/master/scripts/setup_minimal.sh
|
# dotfiles, see: https://git.mgrote.net/mg/dotfiles/raw/branch/master/scripts/setup_minimal.sh
|
||||||
# hadolint ignore=DL3001
|
# hadolint ignore=DL3001
|
||||||
RUN git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim \
|
RUN git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim \
|
||||||
|
|
Loading…
Reference in a new issue