banao-tech commited on
Commit
0812cca
·
verified ·
1 Parent(s): 1bf4338

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -16
Dockerfile CHANGED
@@ -1,24 +1,47 @@
1
- FROM docker.io/nvidia/cuda:12.2.2-runtime-ubuntu22.04@sha256:94c1577b2cd9dd6c0312dc04dff9cb2fdce2b268018abc3d7c2dbcacf1155000
2
 
3
  USER root
4
 
 
 
 
 
 
 
5
  # Install system dependencies
6
- RUN chmod 1777 /tmp && apt update -q && apt install -y \
7
- ca-certificates \
8
- wget \
9
- libgl1 \
10
- python3-pip \
11
- libssl3 && \
12
- wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \
13
- dpkg -i /tmp/cuda-keyring.deb && apt update -q && \
14
- apt install -y --no-install-recommends libcudnn8 libcublas-12-2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- # Install Python packages
17
  COPY requirements.txt .
18
- RUN pip3 install --no-cache-dir -r requirements.txt
19
 
20
- # Copy application files
21
- COPY main.py main.py
22
 
23
- # Start the application
24
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM docker.io/nvidia/cuda:12.2.2-runtime-ubuntu22.04
2
 
3
  USER root
4
 
5
+ # Set environment variables for cache directories
6
+ ENV MPLCONFIGDIR=/tmp/matplotlib \
7
+ TRANSFORMERS_CACHE=/tmp/huggingface \
8
+ HUGGINGFACE_HUB_CACHE=/tmp/huggingface \
9
+ DEBIAN_FRONTEND=noninteractive
10
+
11
  # Install system dependencies
12
+ RUN chmod 1777 /tmp \
13
+ && apt-get update -q \
14
+ && apt-get install -y --no-install-recommends \
15
+ ca-certificates \
16
+ wget \
17
+ libgl1 \
18
+ python3 \
19
+ python3-pip \
20
+ libglib2.0-0 \
21
+ git \
22
+ # Install OpenSSL 1.1
23
+ && wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
24
+ && dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
25
+ && rm libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
26
+ # Install CUDA repositories
27
+ && wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
28
+ && dpkg -i /tmp/cuda-keyring.deb \
29
+ && apt-get update -q \
30
+ && apt-get install -y --no-install-recommends \
31
+ libcudnn8 \
32
+ libcublas-12-2 \
33
+ # Clean up
34
+ && apt-get clean \
35
+ && rm -rf /var/lib/apt/lists/* \
36
+ # Create cache directories
37
+ && mkdir -p ${MPLCONFIGDIR} ${TRANSFORMERS_CACHE} \
38
+ && chmod -R 777 /tmp
39
 
40
+ # Install Python dependencies
41
  COPY requirements.txt .
42
+ RUN pip3 install --no-cache-dir -r requirements.txt
43
 
44
+ # Copy application code
45
+ COPY main.py .
46
 
47
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]