Spaces:
Sleeping
Sleeping
Commit ·
c27fef7
1
Parent(s): 6ad81c6
Final Update: Optimized FastAPI backend with root landing page for Vercel frontend connectivity
Browse files12345678910111213141516171819202122232425262728293031FROM python:3.10-slim# Install system dependencies for OpenCV and scikit-imageRUN apt-get update && apt-get install -y \libgl1-mesa-glx \libglib2.0-0 \&& rm -rf /var/lib/apt/lists/*# Set up a new user named "user" with user ID 1000RUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"# Set the working directory to the user's home directoryWORKDIR /home/user/app# Copy the requirements file into the containerCOPY --chown=user requirements.txt .# Install the Python dependenciesRUN pip install --no-cache-dir --upgrade pipRUN pip install --no-cache-dir -r requirements.txt# Copy the rest of the application code into the containerCOPY --chown=user . .# Hugging Face Spaces expects the app to run on port 7860EXPOSE 7860# Command to run the FastAPI applicationCMD ["uvicorn", "bacterial-classifier.api:app", "--host", "0.0.0.0", "--port", "7860"]123456789101112131415161718192021222324252627282930FROM python:3.11-slim# Install system dependencies for OpenCV and MLRUN apt-get update && apt-get install -y \libgl1 \libglib2.0-0 \libsm6 \libxrender1 \libxext6 \&& rm -rf /var/lib/apt/lists/*# Set up userRUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"WORKDIR /home/user/app# Install Python dependenciesCOPY --chown=user requirements.txt .RUN pip install --no-cache-dir --upgrade pipRUN pip install --no-cache-dir -r requirements.txt# Copy source codeCOPY --chown=user . .# Hugging Face usually expects 7860EXPOSE 7860# Run FastAPICMD ["uvicorn", "classifier_service.api:app", "--host", "0.0.0.0", "--port", "7860"]
Dockerfile+12-13