docker_selfhosted / Dockerfile
Leon4gr45's picture
Update Dockerfile
debad0a verified
raw
history blame
976 Bytes
# 1. Start from the PyTorch DEVEL image. This is the correct, full-featured base.
FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-devel
# 2. Set environment variables. The LD_LIBRARY_PATH is good practice but may be redundant
# in this well-configured image. It doesn't hurt to keep it.
ENV DEBIAN_FRONTEND=noninteractive
ENV HF_HOME="/data/huggingface"
ENV UV_CACHE_DIR="/data/uv_cache"
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
# 3. Install git and uv. The base image has most tools, but we add these.
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
RUN pip install uv
# 4. Copy requirements and install them.
COPY requirements.txt .
RUN uv pip install --no-cache --system -r requirements.txt
# 5. Copy the application code.
COPY ./app.py /app/app.py
WORKDIR /app
# 6. Expose the port.
EXPOSE 7860
# 7. Run the application with uvicorn.
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]