yukee1992 commited on
Commit
d841dd2
·
verified ·
1 Parent(s): b67422e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -8
Dockerfile CHANGED
@@ -1,19 +1,25 @@
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
@@ -23,10 +29,11 @@ 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
 
 
1
  FROM python:3.10-slim
2
 
3
+ # Set DNS resolvers
4
+ RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && \
5
+ echo "nameserver 8.8.4.4" >> /etc/resolv.conf
6
+
7
  WORKDIR /app
8
 
9
  # Install system dependencies
10
  RUN apt-get update && \
11
+ apt-get install -y --no-install-recommends \
12
+ gcc \
13
+ python3-dev \
14
+ curl \
15
+ dnsutils \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Copy requirements first
19
  COPY requirements.txt .
 
 
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Copy application
23
  COPY . .
24
 
25
  # Environment variables
 
29
  ENV TELEGRAM_CHAT_ID=""
30
  ENV DEVICE="cpu"
31
  ENV MAX_TOKENS=400
32
+ ENV PYTHONUNBUFFERED=1
33
 
34
  # Health check
35
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
36
+ CMD curl -f http://localhost:${PORT}/health || exit 1
37
 
38
  EXPOSE 7860
39