yukee1992 commited on
Commit
9f7c2d4
·
verified ·
1 Parent(s): 66b6ee3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -2
Dockerfile CHANGED
@@ -1,12 +1,33 @@
1
  FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
- COPY . .
5
 
 
 
 
 
 
 
 
 
 
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
9
- CMD curl -f http://localhost:7860/ || exit 1
10
 
11
  EXPOSE 7860
 
12
  CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
3
  WORKDIR /app
 
4
 
5
+ # Install system dependencies
6
+ RUN apt-get update && \
7
+ apt-get install -y --no-install-recommends gcc python3-dev && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy requirements first to leverage Docker cache
11
+ COPY requirements.txt .
12
+
13
+ # Install Python dependencies
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Copy the rest of the application
17
+ COPY . .
18
+
19
+ # Environment variables
20
+ ENV PORT=7860
21
+ ENV HF_TOKEN=""
22
+ ENV TELEGRAM_BOT_TOKEN=""
23
+ ENV TELEGRAM_CHAT_ID=""
24
+ ENV DEVICE="cpu"
25
+ ENV MAX_TOKENS=400
26
+
27
+ # Health check
28
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
29
+ CMD curl -f http://localhost:7860/health || exit 1
30
 
31
  EXPOSE 7860
32
+
33
  CMD ["python", "app.py"]