Update Dockerfile
Browse files- Dockerfile +31 -9
Dockerfile
CHANGED
@@ -1,11 +1,33 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
USER user
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
COPY . .
|
11 |
-
CMD ["chainlit", "run", "app.py", "-w"]
|
|
|
1 |
+
# Use Python 3.10 as the base image
|
2 |
+
FROM python:3.10-slim
|
3 |
+
|
4 |
+
# Set working directory
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Install uv as root
|
8 |
+
RUN pip install uv
|
9 |
+
|
10 |
+
# Copy requirements file
|
11 |
+
COPY requirements.txt .
|
12 |
+
|
13 |
+
# Install dependencies system-wide (as root)
|
14 |
+
RUN uv pip install --system -r requirements.txt
|
15 |
+
|
16 |
+
# Create a non-root user for running the application
|
17 |
RUN useradd -m -u 1000 user
|
18 |
+
|
19 |
+
# Create necessary directories for Chainlit and set permissions
|
20 |
+
RUN mkdir -p /app/.files /app/.cache && \
|
21 |
+
chown -R user:user /app
|
22 |
+
|
23 |
+
# Copy the application code and set proper ownership
|
24 |
+
COPY --chown=user . .
|
25 |
+
|
26 |
+
# Switch to the non-root user for running the application
|
27 |
USER user
|
28 |
+
|
29 |
+
# Expose the port for Hugging Face Spaces (required)
|
30 |
+
EXPOSE 7860
|
31 |
+
|
32 |
+
# Command to run the application on Hugging Face's required port
|
33 |
+
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|