zenvolt-api / Dockerfile
happynickamazon's picture
Upload folder using huggingface_hub
3ee626d verified
Raw History Blame Contribute Delete
979 Bytes
# Production Dockerfile for ZenVolt AI API on Hugging Face Spaces
FROM python:3.11-slim
# Install system dependencies (needed for some AI libraries)
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home environment variable
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory
WORKDIR $HOME/app
# Copy requirements first to leverage Docker cache
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the rest of the application code
COPY --chown=user . .
# Ensure model directories exist and have proper permissions
RUN mkdir -p models data plots
# Expose the standard Hugging Face port
EXPOSE 7860
# Run the API server
CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]