Spaces:
Sleeping
Sleeping
File size: 1,087 Bytes
422337f abc3592 422337f abc3592 422337f abc3592 510bfe7 b2d9b23 abc3592 422337f abc3592 422337f abc3592 422337f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
FROM python:3.9-slim
# Install system dependencies required for matplotlib and other libraries
RUN apt-get update && apt-get install -y \
gcc \
python3-dev \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 appuser
# Set working directory
WORKDIR /app
# Copy application files
COPY modelLoanAPI.py /app/modelLoanAPI.py
COPY requirements.txt /app/requirements.txt
COPY extended_worker_dataset.csv /app/extended_worker_dataset.csv
COPY extended_worker_dataset_random_reduced.csv /app/extended_worker_dataset_random_reduced.csv
# Set permissions for copied files
RUN chown -R appuser:appuser /app && chmod -R 755 /app
# Create a plots directory with write permissions
RUN mkdir -p /app/plots && chown appuser:appuser /app/plots && chmod -R 775 /app/plots
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Switch to non-root user
USER appuser
# Expose the port
EXPOSE 7860
# Command to run the FastAPI application
CMD ["uvicorn", "modelLoanAPI:app", "--host", "0.0.0.0", "--port", "7860"]
|