deepsafe-services / image /aide /Dockerfile
deepsafe's picture
sync from GitHub (0154d02)
4b0b144 verified
Raw History Blame Contribute Delete
1.24 kB
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 python3-pip python3-dev \
git wget build-essential && \
rm -rf /var/lib/apt/lists/*
RUN ln -sf /usr/bin/python3 /usr/bin/python
RUN pip install --no-cache-dir --upgrade pip "setuptools>=68" wheel
# Install PyTorch with CUDA 12.1 (replaces CPU-only arch-conditional install)
RUN pip install --no-cache-dir \
torch==2.5.1 torchvision==0.20.1 \
--index-url https://download.pytorch.org/whl/cu121
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN git clone https://github.com/shilinyan99/AIDE.git model_code && \
touch model_code/__init__.py && \
touch model_code/models/__init__.py && \
touch model_code/data/__init__.py
RUN mkdir -p /app/weights /app/hf_cache
COPY weights/ /app/weights/
COPY app.py .
ENV MODEL_PORT=5004
ENV PRELOAD_MODEL=false
ENV MODEL_TIMEOUT=600
ENV AIDE_CHECKPOINT=GenImage_train.pth
ENV PYTHONPATH=/app/model_code:$PYTHONPATH
EXPOSE ${MODEL_PORT}
RUN adduser --disabled-password --gecos '' appuser
USER appuser
CMD ["python", "app.py"]