QuantumLearner commited on
Commit
81e0468
·
verified ·
1 Parent(s): 64a2149

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -11
Dockerfile CHANGED
@@ -1,11 +1,29 @@
1
- FROM python:3.9
2
- RUN useradd -m -u 1000 user
3
- USER user
4
- ENV HOME=/home/user \
5
- PATH=/home/user/.local/bin:$PATH
6
- WORKDIR $HOME/app
7
- COPY --chown=user . $HOME/app
8
- COPY ./requirements.txt ~/app/requirements.txt
9
- RUN pip install -r requirements.txt
10
- COPY . .
11
- CMD ["chainlit", "run", "app.py", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim-bookworm
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ PIP_NO_CACHE_DIR=1
6
+
7
+ # Create non-root user
8
+ RUN useradd -m -u 1000 app
9
+ WORKDIR /app
10
+
11
+ # Install Python deps first for caching
12
+ COPY requirements.txt .
13
+ RUN python -m pip install --upgrade pip \
14
+ && pip install --no-cache-dir -r requirements.txt
15
+
16
+ # Copy app code and set ownership
17
+ COPY --chown=app:app . .
18
+ USER app
19
+
20
+ # Hugging Face Spaces listens on this port by default
21
+ ENV PORT=7860
22
+ EXPOSE 7860
23
+
24
+ # Healthcheck
25
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
26
+ CMD curl -fsS http://127.0.0.1:${PORT}/ || exit 1
27
+
28
+ # Run Chainlit
29
+ CMD ["sh", "-c", "chainlit run app.py --headless --host 0.0.0.0 --port ${PORT}"]