magical-box / Dockerfile
mac9087's picture
Update Dockerfile
039c9f7 verified
FROM python:3.10
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
libgl1-mesa-glx \
libglib2.0-0 \
ffmpeg \
libsm6 \
libxext6 \
cmake \
&& rm -rf /var/lib/apt/lists/*
# Create output directory and model cache with appropriate permissions
RUN mkdir -p outputs && \
mkdir -p /app/shap_e_model_cache && \
chmod 777 /app/shap_e_model_cache && \
chmod 777 outputs
# Copy application code
COPY app.py .
COPY requirements.txt .
# Install Python dependencies - let Shap-E determine the correct versions
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir "git+https://github.com/openai/shap-e.git@main"
# Expose the port
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV SHAPEE_NO_INTERACTIVE=1
ENV XDG_CACHE_HOME=/app
# Run the application with timeout set to 300 seconds for longer model loading
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "300", "app:app"]