# Use an official Python runtime as a base image FROM python:3.11-slim # Set the working directory inside the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ libpq-dev \ gcc \ ffmpeg \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # --- تنظیمات ریجستری پایتون (Runflare) --- # روش پیشنهادی استفاده از ENV است که روی تمام دستورات pip تاثیر می‌گذارد ENV PIP_INDEX_URL=https://mirror-pypi.runflare.com/simple ENV PIP_TRUSTED_HOST=mirror-pypi.runflare.com # اگر اصرار دارید دقیقا از دستورات config استفاده کنید، به این صورت جایگزین کنید: # RUN pip config set global.index-url https://mirror-pypi.runflare.com/simple && \ # pip config set global.trusted-host mirror-pypi.runflare.com # نکته: خط مربوط به npm config حذف شد چون در این ایمیج npm وجود ندارد. # اگر به Node نیاز دارید، باید ابتدا آن را نصب کنید. # Copy requirements.txt to the container COPY requirements.txt . # Upgrade pip and install wheel using the mirror RUN pip install --no-cache-dir --upgrade pip setuptools wheel # Install the Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the FastAPI app code into the container COPY . . # Expose port 8000 EXPOSE 8000 # Command to run FastAPI app CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]