Update Dockerfile
Browse files- Dockerfile +9 -0
Dockerfile
CHANGED
@@ -40,9 +40,17 @@ RUN apt-get update && apt-get install -y \
|
|
40 |
COPY requirements.txt .
|
41 |
RUN pip install --no-cache-dir -r requirements.txt
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
# Copy the rest of the application
|
44 |
COPY . .
|
45 |
|
|
|
|
|
|
|
46 |
# Expose the port the app runs on
|
47 |
EXPOSE 7860
|
48 |
|
@@ -50,6 +58,7 @@ EXPOSE 7860
|
|
50 |
ENV OPENAI_API_KEY=None
|
51 |
ENV ENVIRONMENT="production"
|
52 |
ENV PORT=7860
|
|
|
53 |
|
54 |
# Command to run the application
|
55 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
40 |
COPY requirements.txt .
|
41 |
RUN pip install --no-cache-dir -r requirements.txt
|
42 |
|
43 |
+
# 配置 DrissionPage
|
44 |
+
RUN cd /usr/local/lib/python3.11/site-packages/DrissionPage/_configs/ && \
|
45 |
+
sed -i "/browser_path/s/$(grep 'browser_path' 'configs.ini' | awk -F '=' '{print $2}')/\/usr\/bin\/google-chrome-stable/" configs.ini && \
|
46 |
+
sed -i "/arguments/s/\[/\[\'--no-sandbox\', \'--headless=new\', /" configs.ini
|
47 |
+
|
48 |
# Copy the rest of the application
|
49 |
COPY . .
|
50 |
|
51 |
+
# 创建并设置 Chrome 数据目录
|
52 |
+
RUN mkdir -p /tmp/chrome-data && chmod 777 /tmp/chrome-data
|
53 |
+
|
54 |
# Expose the port the app runs on
|
55 |
EXPOSE 7860
|
56 |
|
|
|
58 |
ENV OPENAI_API_KEY=None
|
59 |
ENV ENVIRONMENT="production"
|
60 |
ENV PORT=7860
|
61 |
+
ENV CHROME_PATH=/usr/bin/google-chrome-stable
|
62 |
|
63 |
# Command to run the application
|
64 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|