Spaces:
Running
Running
# 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"] |