File size: 796 Bytes
7f0f917 975e90a 7f0f917 975e90a 7f0f917 975e90a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | FROM python:3.12
# Run as root to install system packages and setup sudo
USER root
# Install standard Dev Mode dependencies and sudo
RUN apt-get update && apt-get install -y \
bash curl wget procps git git-lfs sudo \
&& rm -rf /var/lib/apt/lists/*
# Create the user and add to sudoers with no password requirement
RUN useradd -m -u 1000 user \
&& usermod -aG sudo user \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Switch back to the non-root user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy files and install python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|