File size: 847 Bytes
498708d
60f01af
498708d
60f01af
 
 
 
f139a57
 
498708d
f139a57
61bf166
cd2e7f3
 
3993477
498708d
b601f8a
 
2a46da5
 
 
498708d
60f01af
 
498708d
 
3c37526
498708d
 
60f01af
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
28
29
30
31
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"]