38 lines
1.2 KiB
Docker
Executable File
38 lines
1.2 KiB
Docker
Executable File
# Base image
|
|
FROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel
|
|
|
|
# Set timezone and working directory
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
ENV TZ=Asia/Seoul
|
|
WORKDIR /opt/workspace
|
|
|
|
# Use a faster mirror for apt-get
|
|
RUN sed -i 's/archive.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list
|
|
|
|
# Install tzdata and set the timezone to Asia/Seoul
|
|
RUN apt-get update && apt-get install -y tzdata && \
|
|
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
|
|
echo "Asia/Seoul" > /etc/timezone && \
|
|
dpkg-reconfigure -f noninteractive tzdata
|
|
|
|
# Install system dependencies (including dependencies for Hugging Face login)
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
vim \
|
|
curl \
|
|
&& apt-get clean
|
|
|
|
# Upgrade pip and install Python dependencies, including Hugging Face CLI
|
|
COPY requirements.txt .
|
|
RUN pip install --upgrade pip && \
|
|
pip install huggingface_hub && \
|
|
pip install -r requirements.txt
|
|
|
|
# Copy project files into the container
|
|
COPY . .
|
|
|
|
# Set Python to output logs in real time
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Default command to run both uvicorn server and worker
|
|
# CMD ["/bin/bash", "-c", "uvicorn main:app --host 0.0.0.0 --port 8000 & python /opt/workspace/worker.py"] |