nothere990 commited on
Commit
092d53d
·
1 Parent(s): 6732ba1
Files changed (2) hide show
  1. Dockerfile +25 -25
  2. Dockerfile.bak +64 -0
Dockerfile CHANGED
@@ -1,41 +1,38 @@
1
  FROM python:3.9.5-buster
2
 
3
- # Install system dependencies as root
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  git \
6
  wget \
7
  curl \
8
  unzip \
 
 
 
 
 
 
 
 
9
  fonts-liberation \
10
- libatk-bridge2.0-0 \
11
- libatk1.0-0 \
12
- libatspi2.0-0 \
13
- libcairo2 \
14
- libcups2 \
15
- libgtk-3-0 \
16
- libpango-1.0-0 \
17
- libvulkan1 \
18
- libxcomposite1 \
19
- libxkbcommon0 \
20
- libxrandr2 \
21
  xdg-utils \
22
- libnss3 \
23
- libnspr4 \
24
- libgbm1 \
25
  ffmpeg \
26
  && rm -rf /var/lib/apt/lists/*
27
 
28
- # Install Chrome
29
- RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
30
- && apt-get install -y ./google-chrome-stable_current_amd64.deb \
31
- && rm google-chrome-stable_current_amd64.deb
 
 
32
 
33
- # Install matching Chromedriver
34
- RUN CHROME_VERSION=$(google-chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) \
35
- && wget -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} \
36
- && wget -q https://chromedriver.storage.googleapis.com/$(cat LATEST_RELEASE_${CHROME_VERSION})/chromedriver_linux64.zip \
37
- && unzip chromedriver_linux64.zip -d /usr/bin/ \
38
- && rm chromedriver_linux64.zip LATEST_RELEASE_${CHROME_VERSION}
 
39
 
40
  # Create user with UID 1000
41
  RUN useradd -m -u 1000 user
@@ -61,4 +58,7 @@ RUN pip install --no-cache-dir --upgrade pip \
61
  # Copy application code
62
  COPY --chown=user . .
63
 
 
 
 
64
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9.5-buster
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  git \
6
  wget \
7
  curl \
8
  unzip \
9
+ libgconf-2-4 \
10
+ libnss3 \
11
+ libgl1 \
12
+ libx11-xcb1 \
13
+ libxcb-dri3-0 \
14
+ libdrm2 \
15
+ libgbm1 \
16
+ libasound2 \
17
  fonts-liberation \
 
 
 
 
 
 
 
 
 
 
 
18
  xdg-utils \
 
 
 
19
  ffmpeg \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Install Chrome using your preferred method
23
+ RUN mkdir -p /tmp/ && \
24
+ cd /tmp/ && \
25
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
26
+ dpkg -i ./google-chrome-stable_current_amd64.deb || apt-get install -fqqy && \
27
+ rm ./google-chrome-stable_current_amd64.deb
28
 
29
+ # Install Chromedriver using your specified method
30
+ RUN mkdir -p /tmp/ && \
31
+ cd /tmp/ && \
32
+ wget -O chromedriver.zip https://chromedriver.storage.googleapis.com/$(curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
33
+ unzip -o chromedriver.zip chromedriver -d /usr/bin/ && \
34
+ chmod +x /usr/bin/chromedriver && \
35
+ rm chromedriver.zip
36
 
37
  # Create user with UID 1000
38
  RUN useradd -m -u 1000 user
 
58
  # Copy application code
59
  COPY --chown=user . .
60
 
61
+ # Verification commands
62
+ RUN google-chrome --version && chromedriver --version
63
+
64
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
Dockerfile.bak ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9.5-buster
2
+
3
+ # Install system dependencies as root
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ git \
6
+ wget \
7
+ curl \
8
+ unzip \
9
+ fonts-liberation \
10
+ libatk-bridge2.0-0 \
11
+ libatk1.0-0 \
12
+ libatspi2.0-0 \
13
+ libcairo2 \
14
+ libcups2 \
15
+ libgtk-3-0 \
16
+ libpango-1.0-0 \
17
+ libvulkan1 \
18
+ libxcomposite1 \
19
+ libxkbcommon0 \
20
+ libxrandr2 \
21
+ xdg-utils \
22
+ libnss3 \
23
+ libnspr4 \
24
+ libgbm1 \
25
+ ffmpeg \
26
+ && rm -rf /var/lib/apt/lists/*
27
+
28
+ # Install Chrome
29
+ RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
30
+ && apt-get install -y ./google-chrome-stable_current_amd64.deb \
31
+ && rm google-chrome-stable_current_amd64.deb
32
+
33
+ # Install matching Chromedriver
34
+ RUN CHROME_VERSION=$(google-chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) \
35
+ && wget -q https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION} \
36
+ && wget -q https://chromedriver.storage.googleapis.com/$(cat LATEST_RELEASE_${CHROME_VERSION})/chromedriver_linux64.zip \
37
+ && unzip chromedriver_linux64.zip -d /usr/bin/ \
38
+ && rm chromedriver_linux64.zip LATEST_RELEASE_${CHROME_VERSION}
39
+
40
+ # Create user with UID 1000
41
+ RUN useradd -m -u 1000 user
42
+
43
+ # Set environment variables
44
+ ENV HOME=/home/user \
45
+ PATH=/home/user/.local/bin:$PATH \
46
+ CHROME_DRIVER=/usr/bin/chromedriver \
47
+ CHROME_BIN=/usr/bin/google-chrome-stable \
48
+ PYTHONUNBUFFERED=1
49
+
50
+ # Set working directory
51
+ WORKDIR $HOME/app
52
+
53
+ # Switch to non-root user
54
+ USER user
55
+
56
+ # Copy requirements first to leverage Docker cache
57
+ COPY --chown=user requirements.txt .
58
+ RUN pip install --no-cache-dir --upgrade pip \
59
+ && pip install --no-cache-dir -r requirements.txt
60
+
61
+ # Copy application code
62
+ COPY --chown=user . .
63
+
64
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]