File size: 1,375 Bytes
526927a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# GPU ํ™˜๊ฒฝ์„ ์œ„ํ•œ Dockerfile
FROM nvidia/cuda:11.8-devel-ubuntu20.04

# ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ •
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV CUDA_VISIBLE_DEVICES=0

# ์‹œ์Šคํ…œ ํŒจํ‚ค์ง€ ์—…๋ฐ์ดํŠธ ๋ฐ ์„ค์น˜
RUN apt-get update && apt-get install -y \
    python3.9 \
    python3.9-dev \
    python3-pip \
    git \
    wget \
    curl \
    build-essential \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

# Python 3.9์„ ๊ธฐ๋ณธ์œผ๋กœ ์„ค์ •
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1

# ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ ์„ค์ •
WORKDIR /app

# Python ์˜์กด์„ฑ ํŒŒ์ผ ๋ณต์‚ฌ
COPY requirements.txt .

# Python ํŒจํ‚ค์ง€ ์„ค์น˜
RUN pip3 install --no-cache-dir -r requirements.txt

# GPU ๊ด€๋ จ ํŒจํ‚ค์ง€ ์„ค์น˜
RUN pip3 install --no-cache-dir \
    torch==2.0.1+cu118 \
    torchvision==0.15.2+cu118 \
    torchaudio==2.0.2+cu118 \
    --index-url https://download.pytorch.org/whl/cu118

# ํ”„๋กœ์ ํŠธ ํŒŒ์ผ ๋ณต์‚ฌ
COPY . .

# ํฌํŠธ ์„ค์ •
EXPOSE 8001

# ํ—ฌ์Šค์ฒดํฌ ์ถ”๊ฐ€
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8001/health || exit 1

# ์‹คํ–‰ ๋ช…๋ น
CMD ["python3", "run_server_v2.py"]