QuantumLearner commited on
Commit
00bfb0a
·
verified ·
1 Parent(s): 5ba2cd9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -5
Dockerfile CHANGED
@@ -1,14 +1,21 @@
1
  FROM python:3.9-slim-bookworm
 
 
 
 
 
 
2
  WORKDIR /app
3
 
4
- # system deps (minimal)
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
- build-essential curl git ca-certificates \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- # python deps
10
  COPY requirements.txt .
11
- RUN pip install --no-cache-dir -r requirements.txt
 
12
 
13
  # your code
14
  COPY . .
@@ -16,5 +23,8 @@ COPY . .
16
  ENV PORT=7860
17
  EXPOSE 7860
18
 
19
- # run your app.py
 
 
 
20
  CMD ["sh", "-c", "streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT}"]
 
1
  FROM python:3.9-slim-bookworm
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ PIP_NO_CACHE_DIR=1 \
6
+ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
7
+
8
  WORKDIR /app
9
 
10
+ # system deps (keep minimal; drop build-essential if not building wheels)
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ curl git ca-certificates \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # python deps (better cache behavior)
16
  COPY requirements.txt .
17
+ RUN python -m pip install --upgrade pip \
18
+ && pip install --no-cache-dir --prefer-binary -r requirements.txt
19
 
20
  # your code
21
  COPY . .
 
23
  ENV PORT=7860
24
  EXPOSE 7860
25
 
26
+ # healthcheck helps detect boot issues
27
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
28
+ CMD curl --fail http://127.0.0.1:${PORT}/_stcore/health || exit 1
29
+
30
  CMD ["sh", "-c", "streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT}"]