backend / Dockerfile
12ongo's picture
Upload Dockerfile
38a55af verified
Raw History Blame Contribute Delete
692 Bytes
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# Copy application code
COPY app.py /app/app.py
# Copy model artifact
RUN mkdir -p /app/deployment_files
COPY deployment_files/sales_predictor.joblib /app/deployment_files/sales_predictor.joblib
# Expose default port used by Spaces if PORT is not provided
EXPOSE 7860
# Start the API using gunicorn, binding to the dynamic PORT provided by HF Spaces
ENV PORT=7860
CMD ["sh", "-c", "gunicorn -w 1 -k gthread -b 0.0.0.0:$PORT app:sales_predictor_api"]