lily_fast_api / Dockerfile.gpu
gbrabbit's picture
Fresh start for HF Spaces deployment
526927a
# 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"]