moderation / Dockerfile
Kiran5's picture
adding files
2a46da5
raw
history blame contribute delete
847 Bytes
FROM python:3.9-slim
# Create and use a non-root user for security
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy necessary files
COPY --chown=user ./requirements.txt requirements.txt
COPY --chown=user ./lib/aicloudlibs-0.1.0-py3-none-any.whl /lib/
COPY --chown=user ./lib/better_profanity-2.0.0-py3-none-any.whl /lib/
COPY --chown=user ./lib/privacy-1.0.9-py3-none-any.whl /lib/
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Ensure log directory exists and is writable by the non-root user
RUN mkdir -p /home/user/logs && chown -R user:user /home/user/logs
# Expose the port used by Hugging Face Spaces (7860)
EXPOSE 7860
# Copy the rest of the app
COPY --chown=user . /app
# Command to run the app (avoid Waitress here)
CMD ["python", "main.py"]