EmoVitt / Dockerfile
Luisnguyen1
c
0aff151
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive \
TRANSFORMERS_CACHE=/app/.cache/transformers \
HF_HOME=/app/.cache/huggingface \
TORCH_HOME=/app/.cache/torch \
HF_DATASETS_CACHE=/app/.cache/datasets
# Install basic dependencies and add deadsnakes PPA for Python 3.11
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
dos2unix \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python3.11 \
python3.11-dev \
python3.11-distutils \
python3.11-venv \
git \
wget \
curl \
ca-certificates \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create symbolic link for python
RUN ln -sf /usr/bin/python3.11 /usr/bin/python
# Install pip for Python 3.11
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.11
# Create cache directories
RUN mkdir -p /app/.cache/transformers \
/app/.cache/huggingface \
/app/.cache/torch \
/app/.cache/datasets
COPY LAVIS ./LAVIS
RUN cd LAVIS \
&& python3.11 -m pip install --no-cache-dir -e .
# Copy requirements files and install dependencies
# Note: We'll install with modern pip options to avoid deprecation warnings
COPY requirements.txt .
RUN pip install --no-cache-dir --use-pep517 --no-deps -r requirements.txt
# Copy application files
COPY app.py ./
COPY blip2_vicuna_instruct.py ./LAVIS/lavis/models/blip2_models/
COPY static/ ./static/
COPY templates/ ./templates/
COPY start.sh ./
RUN dos2unix /app/start.sh && chmod +x /app/start.sh
# Create directory for model weights
RUN mkdir -p /app/LAVIS/lavis/weight/vicuna-7b-2/
# Set up a volume for persistent cache
VOLUME /app/.cache
# Set the default command to run the Flask app
CMD ["./start.sh"]