CoolFace
Apppublic

somoncef/glamflow-model

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
Dockerfile60 linesDownload Raw Back to root
1# Use official Python base image2FROM python:3.9-slim3 4# Install system dependencies5RUN apt-get update && apt-get install -y --no-install-recommends \6    build-essential \7    libgl1 \8    libglib2.0-0 \9    libsm6 \10    libxext6 \11    libxrender-dev \12    && rm -rf /var/lib/apt/lists/*13 14# Set up a new user named "user" with user ID 100015RUN useradd -m -u 1000 user16 17# Switch to the "user" user18USER user19 20# Set TensorFlow environment variables21ENV TF_CPP_MIN_LOG_LEVEL=2 \22    TF_ENABLE_ONEDNN_OPTS=0 \23    CUDA_VISIBLE_DEVICES=-1 \24    XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda \25    TF_FORCE_GPU_ALLOW_GROWTH=true \26    PYTHONWARNINGS="ignore" \27    PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \28    TF_KERAS_BACKEND=tensorflow29 30# Set home to the user's home directory31ENV HOME=/home/user \32    PATH=/home/user/.local/bin:$PATH33 34# Set the working directory to the user's home directory35WORKDIR $HOME/app36 37# Create directory for saved models38RUN mkdir -p $HOME/app/saved_models39 40# Copy requirements first - with proper ownership41COPY --chown=user requirements.txt .42 43# Install Python dependencies44RUN pip install --no-cache-dir -r requirements.txt45 46# Copy all files with proper ownership47COPY --chown=user . .48 49# Expose the port Hugging Face Spaces uses50EXPOSE 786051 52# Start Gunicorn server with optimized settings53CMD ["gunicorn", \54     "--bind", "0.0.0.0:7860", \55     "--timeout", "300", \56     "--workers", "1", \57     "--threads", "4", \58     "--worker-class", "gthread", \59     "--preload", \60     "app:app"]