QuantumLearner commited on
Commit
7aa89be
·
verified ·
1 Parent(s): 81e0468

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -22
Dockerfile CHANGED
@@ -1,29 +1,24 @@
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}"]
 
1
+ FROM python:3.9
 
 
 
 
2
 
3
  # Create non-root user
4
+ RUN useradd -m -u 1000 user
5
+
6
+ # Environment for user installs
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
 
10
+ # Workdir
11
+ WORKDIR $HOME/app
 
 
12
 
13
+ # Use non-root user
14
+ USER user
 
15
 
16
+ # Install dependencies (cache-friendly)
17
+ COPY --chown=user requirements.txt $HOME/app/requirements.txt
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Copy app source
21
+ COPY --chown=user . $HOME/app
 
22
 
23
+ # Start app
24
+ CMD ["chainlit", "run", "app.py", "--port", "7860"]