File size: 674 Bytes
50ab210
 
 
 
 
 
 
 
 
 
360f4e6
 
 
d834c46
 
 
 
50ab210
 
 
d834c46
 
 
 
50ab210
 
 
 
 
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
# Use the official Python image from Docker Hub
FROM python:3.11-slim

# Set the working directory
WORKDIR /app

# Copy the application files
COPY app.py /app/
COPY requirements.txt /app/

# Create a writable cache directory for Hugging Face
ENV HF_HOME=/app/hf_cache
RUN mkdir -p /app/hf_cache

# Set permissions for the cache directory
RUN chmod -R 777 /app/hf_cache

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Create a non-root user and switch to it
RUN useradd -m appuser
USER appuser

# Expose the Streamlit port
EXPOSE 7860

# Run the Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]