Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647# # Base image# FROM python:3.11-slim# # Set environment variables# ENV PYTHONDONTWRITEBYTECODE 1# ENV PYTHONUNBUFFERED 1# # Install OS dependencies# RUN apt-get update && apt-get install -y \# build-essential \# curl \# git \# && rm -rf /var/lib/apt/lists/*# # Create working directory# WORKDIR /code# # Install Python dependencies# COPY requirements.txt /code/# RUN pip install --no-cache-dir -r requirements.txt# # Copy app code# COPY . /code/# # Expose port# EXPOSE 7860# # 🚀 Start FastAPI using Uvicorn# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]FROM python:3.11-slim# Set work directoryWORKDIR /app# Install dependenciesCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# Copy application codeCOPY . .# Expose the Hugging Face default portEXPOSE 7860# Run FastAPI app using uvicornCMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]123456789101112131415161718192021# Use an official Python runtime as a parent imageFROM python:3.11-slim# Set the working directory in the containerWORKDIR /code# Copy the requirements file into the containerCOPY ./requirements.txt /code/requirements.txt# Install any needed packages specified in requirements.txtRUN pip install --no-cache-dir --upgrade -r /code/requirements.txt# Copy the rest of your app's code (app.py and the utils folder)COPY . /code/# Expose the port the app runs onEXPOSE 7860# --- FINAL, ROBUST START COMMAND ---# This method is more explicit and can resolve path issues inside the container.CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
Dockerfile+14-40