Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +31 -0
Dockerfile
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# Create a non-root user (UID 1000)
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
+
|
6 |
+
# Set the working directory
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
# Copy all files into /app
|
10 |
+
COPY . /app
|
11 |
+
|
12 |
+
# (Optional) Adjust permissions
|
13 |
+
RUN chown -R user:user /app
|
14 |
+
RUN chmod -R 777 /app
|
15 |
+
|
16 |
+
# Switch to non-root user
|
17 |
+
USER user
|
18 |
+
|
19 |
+
# Set environment variables
|
20 |
+
ENV HF_HOME=/app/.cache \
|
21 |
+
HOME=/home/user \
|
22 |
+
PATH=/home/user/.local/bin:$PATH
|
23 |
+
|
24 |
+
# Install Python dependencies
|
25 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
+
|
27 |
+
# Expose the port for Hugging Face Spaces
|
28 |
+
EXPOSE 7860
|
29 |
+
|
30 |
+
# Run Chainlit when the container starts
|
31 |
+
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|