Browse Source

Added Dockfile changes to install sudo, create appuser for least privledge

pull/327/head
Kevin Roberto Perdomo 12 months ago
parent
commit
27aed43a3c
  1. 24
      Dockerfile

24
Dockerfile

@ -6,19 +6,37 @@ RUN apt-get update \
git \
build-essential \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
sudo\
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Create a non-root user
RUN useradd --create-home appuser \
&& echo "appuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/appuser \
&& chmod 0440 /etc/sudoers.d/appuser
# Switch to the non-root user
USER appuser
# Set up work directory
WORKDIR /home/appuser/app
# Install pipx
RUN python3 -m pip install --upgrade pip \
&& python3 -m pip install --user pipx \
&& python3 -m pipx ensurepath
# Set up work directory
WORKDIR /app
# Clone the repository and install its dependencies
RUN git clone https://github.com/danielmiessler/fabric.git \
&& python3 -m pipx install ./fabric
# Set file permissions for the app directory
RUN chmod -R 755 /home/appuser/app
# Switch back to the non-root user
USER appuser
# Set the entrypoint
ENTRYPOINT ["/usr/bin/bash"]
Loading…
Cancel
Save