Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +14 -10
Dockerfile
CHANGED
|
@@ -1,23 +1,27 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN apt-get update && apt-get install -y \
|
| 9 |
-
git \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
# Copy requirements and install
|
| 13 |
COPY requirements.txt .
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
-
# Copy app
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
EXPOSE 8000
|
| 21 |
|
| 22 |
-
#
|
| 23 |
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
+
# Base image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# Create a new user
|
| 5 |
+
RUN useradd -ms /bin/bash chainlituser
|
| 6 |
+
|
| 7 |
# Set working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# Copy and install dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
+
# Copy app code
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
+
# Give new user ownership
|
| 18 |
+
RUN chown -R chainlituser:chainlituser /app
|
| 19 |
+
|
| 20 |
+
# Switch to the new user
|
| 21 |
+
USER chainlituser
|
| 22 |
+
|
| 23 |
+
# Expose the Chainlit port
|
| 24 |
EXPOSE 8000
|
| 25 |
|
| 26 |
+
# Start Chainlit
|
| 27 |
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "8000"]
|