-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
66 lines (58 loc) · 2.38 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM python:3.12.7-slim AS base
WORKDIR /work/
RUN apt-get update && apt-get install -y \
bzip2 \
gnupg \
libasound2-dev \
libatk-bridge2.0-dev \
libatk1.0-dev \
libcups2-dev \
libdbus-1-3 \
libdbus-glib-1-2 \
libgl1-mesa-dev \
libglib2.0-0 \
libgtk-3-0 \
libnss3-dev \
libpango1.0-dev \
libpci-dev \
libsm6 \
libx11-xcb-dev \
libxcomposite-dev \
libxdamage-dev \
libxext6 \
libxkbcommon-dev \
libxrandr-dev \
libxrender-dev \
libxt6 \
libxtst6 \
openssl \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Install Chrome and ChromeDriver
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update && apt search google-chrome-stable && apt-get install -y "google-chrome-stable=131.0.6778.*" && rm -rf /var/lib/apt/lists/*
RUN wget -N https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.204/linux64/chromedriver-linux64.zip -P /tmp
RUN unzip /tmp/chromedriver-linux64.zip -d /tmp/chromedriver-extract
RUN find /tmp/chromedriver-extract -type f -exec mv {} /usr/local/bin/ \;
RUN chmod +x /usr/local/bin/chromedriver
# Install Firefox & GeckoDriver
RUN wget -O /tmp/geckodriver.tar.gz -N https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
RUN tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin/ \
&& chmod +x /usr/local/bin/geckodriver
RUN wget -O /tmp/firefox.tar.bz2 "https://archive.mozilla.org/pub/firefox/releases/131.0/linux-x86_64/en-US/firefox-131.0.tar.bz2"
RUN tar -xjf /tmp/firefox.tar.bz2 -C /opt/ \
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox
COPY ./pyproject.toml /work/pyproject.toml
COPY ./pyproject.toml ./pyproject.toml
RUN awk '/dependencies = \[/{flag=1;next}/\]/{flag=0}flag' pyproject.toml | sed 's/[",]//g' > requirements.txt && \
awk '/web = \[/{flag=1;next}/\]/{flag=0}flag' pyproject.toml | sed 's/[",]//g' >> requirements.txt && \
pip install -r requirements.txt
COPY shooter /work/shooter/
RUN pip install --no-cache-dir -e .
ENV CHROMEDRIVER_PATH=/usr/local/bin/chromedriver
ENV GECKODRIVER_PATH=/usr/local/bin/geckodriver
ENV PYTHONPATH=/work/shooter/
EXPOSE 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]