prshntdxt's picture
Update Dockerfile
f462fe5 verified
raw
history blame
1.67 kB
# Base image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# -------------------------------------------------
# System dependencies (TensorFlow / HDF5 support)
# -------------------------------------------------
RUN apt-get update && apt-get install -y \
libsm6 \
libxext6 \
libxrender-dev \
libhdf5-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# -------------------------------------------------
# Python dependencies
# -------------------------------------------------
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# -------------------------------------------------
# Create required directories FIRST
# -------------------------------------------------
RUN mkdir -p models logs
# -------------------------------------------------
# Copy application code
# -------------------------------------------------
COPY main.py .
COPY schemas.py .
COPY inference/ ./inference/
# -------------------------------------------------
# Copy trained model (FIXED)
# -------------------------------------------------
COPY models/Forest_Segmentation_Best.keras models/Forest_Segmentation_Best.keras
# -------------------------------------------------
# Environment variables
# -------------------------------------------------
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# -------------------------------------------------
# Hugging Face Spaces port
# -------------------------------------------------
EXPOSE 7860
# -------------------------------------------------
# Run FastAPI server
# -------------------------------------------------
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]