AndreySokolov01 commited on
Commit
da7a4cb
1 Parent(s): eadcb42

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +66 -6
Dockerfile CHANGED
@@ -1,14 +1,74 @@
 
 
 
 
1
 
2
- FROM python:3.9
3
 
4
- RUN useradd -m -u 1000 user
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  WORKDIR /app
7
 
8
- COPY --chown=user ./requirements.txt requirements.txt
 
 
 
 
 
 
 
 
 
 
9
 
10
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
11
 
12
- COPY --chown=user . /app
 
13
 
14
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ ARG CUDA_VERSION="11.8.0"
2
+ ARG CUDNN_VERSION="8"
3
+ ARG UBUNTU_VERSION="22.04"
4
+ ARG MAX_JOBS=4
5
 
6
+ FROM nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN_VERSION-devel-ubuntu$UBUNTU_VERSION
7
 
8
+ # Update package lists and install necessary packages
9
+ RUN apt-get update && \
10
+ apt-get install -y --no-install-recommends \
11
+ wget \
12
+ curl \
13
+ unzip \
14
+ git \
15
+ python3 \
16
+ python3-pip \
17
+ libgl1 \
18
+ libglib2.0-0 \
19
+ curl \
20
+ gnupg2 \
21
+ ca-certificates \
22
+ apt-transport-https \
23
+ software-properties-common \
24
+ libreoffice \
25
+ ffmpeg \
26
+ git-lfs \
27
+ xvfb \
28
+ && ln -s /usr/bin/python3 /usr/bin/python \
29
+ && curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \
30
+ && wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
31
+ && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
32
+ && apt-get update \
33
+ && apt install python3-packaging \
34
+ && apt-get install -y --no-install-recommends google-chrome-stable \
35
+ && rm -rf /var/lib/apt/lists/*
36
 
37
+ # Download and install ChromeDriver
38
+ RUN CHROMEDRIVER_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE) && \
39
+ wget -N https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip -P /tmp && \
40
+ unzip /tmp/chromedriver_linux64.zip -d /tmp && \
41
+ mv /tmp/chromedriver /usr/local/bin/chromedriver && \
42
+ chmod +x /usr/local/bin/chromedriver && \
43
+ rm /tmp/chromedriver_linux64.zip
44
+
45
+ # Copy Chromedriver from the builder stage (if applicable)
46
+ # COPY --from=builder /usr/local/bin/chromedriver /usr/local/bin/chromedriver
47
+
48
+ # Install PyTorch and related packages
49
+ RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
50
+
51
+ # Set up working directory and copy application code
52
+ COPY . /app
53
  WORKDIR /app
54
 
55
+ # Install Python package (assuming it has a setup.py)
56
+ RUN pip3 install --no-cache-dir -e .
57
+
58
+ RUN pip install transformers==4.41.2
59
+
60
+ # Set environment variables
61
+ ENV CHROME_BIN=/usr/bin/google-chrome \
62
+ CHROMEDRIVER=/usr/local/bin/chromedriver \
63
+ DISPLAY=:99 \
64
+ DBUS_SESSION_BUS_ADDRESS=/dev/null \
65
+ PYTHONUNBUFFERED=1
66
 
67
+ # Ensure the PATH environment variable includes the location of the installed packages
68
+ ENV PATH /usr/local/bin:$PATH
69
 
70
+ # Expose the desired port
71
+ EXPOSE 8000
72
 
73
+ # Run the server
74
+ CMD ["python", "server.py", "--host", "0.0.0.0", "--port", "8000", "--documents", "--media", "--web"]