Update Dockerfile
Browse files- Dockerfile +34 -1
Dockerfile
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
FROM python:3.11-slim
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
# Install system dependencies
|
@@ -8,11 +14,37 @@ RUN apt-get update && apt-get install -y \
|
|
8 |
curl \
|
9 |
libcurl4-openssl-dev \
|
10 |
libssl-dev \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
# Copy requirements first to leverage Docker cache
|
14 |
COPY requirements.txt .
|
15 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
17 |
# Copy the rest of the application
|
18 |
COPY . .
|
@@ -23,6 +55,7 @@ EXPOSE 7860
|
|
23 |
# Environment variables with defaults
|
24 |
ENV OPENAI_API_KEY=None
|
25 |
ENV ENVIRONMENT="production"
|
|
|
26 |
|
27 |
# Command to run the application
|
28 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
FROM python:3.11-slim
|
2 |
|
3 |
+
# 设置为中国国内源(针对 Bookworm/Debian 12)
|
4 |
+
RUN rm -rf /etc/apt/sources.list.d/* && \
|
5 |
+
echo "deb http://mirrors.ustc.edu.cn/debian bookworm main" > /etc/apt/sources.list && \
|
6 |
+
echo "deb http://mirrors.ustc.edu.cn/debian bookworm-updates main" >> /etc/apt/sources.list && \
|
7 |
+
echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main" >> /etc/apt/sources.list
|
8 |
+
|
9 |
WORKDIR /app
|
10 |
|
11 |
# Install system dependencies
|
|
|
14 |
curl \
|
15 |
libcurl4-openssl-dev \
|
16 |
libssl-dev \
|
17 |
+
# Chrome dependencies
|
18 |
+
wget \
|
19 |
+
gnupg \
|
20 |
+
fonts-liberation \
|
21 |
+
libasound2 \
|
22 |
+
libatk-bridge2.0-0 \
|
23 |
+
libatk1.0-0 \
|
24 |
+
libatspi2.0-0 \
|
25 |
+
libcups2 \
|
26 |
+
libdbus-1-3 \
|
27 |
+
libdrm2 \
|
28 |
+
libgbm1 \
|
29 |
+
libgtk-3-0 \
|
30 |
+
libnspr4 \
|
31 |
+
libnss3 \
|
32 |
+
libxcomposite1 \
|
33 |
+
libxdamage1 \
|
34 |
+
libxfixes3 \
|
35 |
+
libxkbcommon0 \
|
36 |
+
libxrandr2 \
|
37 |
+
xdg-utils \
|
38 |
+
# Install Chrome
|
39 |
+
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
40 |
+
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
|
41 |
+
&& apt-get update \
|
42 |
+
&& apt-get install -y google-chrome-stable \
|
43 |
&& rm -rf /var/lib/apt/lists/*
|
44 |
|
45 |
# Copy requirements first to leverage Docker cache
|
46 |
COPY requirements.txt .
|
47 |
+
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
48 |
|
49 |
# Copy the rest of the application
|
50 |
COPY . .
|
|
|
55 |
# Environment variables with defaults
|
56 |
ENV OPENAI_API_KEY=None
|
57 |
ENV ENVIRONMENT="production"
|
58 |
+
ENV PORT=7860
|
59 |
|
60 |
# Command to run the application
|
61 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|