canspace / Dockerfile
Pujan Neupane
Project : pushing all the files to hugging face
e9f0d54
raw
history blame contribute delete
786 Bytes
# Use the latest slim Python 3.11 image
FROM python:3.11-slim
# Set environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user for safety
RUN useradd -ms /bin/bash user
USER user
WORKDIR $HOME/app
# Copy app source code
COPY --chown=user . .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Expose port
EXPOSE 7860
# Start the FastAPI app using uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]