greenStep / Dockerfile
nivakaran's picture
Update Dockerfile
eb7c28e verified
raw
history blame contribute delete
685 Bytes
# Use Python 3.11 (has SQLite 3.40+) instead of 3.10
FROM python:3.11-slim
# Create non-root user for security
RUN useradd -m -u 1000 user
USER user
# Set environment variables
ENV PATH="/home/user/.local/bin:$PATH"
ENV PYTHONUNBUFFERED=1
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY --chown=user ./requirements.txt requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application files
COPY --chown=user . /app
# Expose port 7860 (Hugging Face Spaces requirement)
EXPOSE 7860
# Run the FastAPI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]