Spaces:
Sleeping
Sleeping
FROM python:3.9 | |
WORKDIR /app | |
# Copy and install Python requirements | |
COPY ./requirements.txt /app/requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
RUN python -m spacy download en_core_web_sm | |
# Copy application files | |
COPY . . | |
# Add a non-root user and adjust permissions | |
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ | |
&& chown -R user:user /app | |
# Ensure the sudo package is installed | |
RUN apt-get update && apt-get install -y sudo \ | |
&& echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user \ | |
&& chmod 440 /etc/sudoers.d/90-user | |
# Set up cache directory for the non-root user | |
RUN mkdir /.cache && chown user:user /.cache | |
# Switch to the non-root user | |
USER user | |
# Default command | |
CMD ["python", "main.py"] | |