Spaces:
Running
Running
# Use the official Python 3.10.9 image as the base | |
FROM python:3.10.9 | |
# Set the working directory in the container | |
WORKDIR /app | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright | |
# Copy the requirements file into the container | |
COPY requirements.txt . | |
# Install Python dependencies | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Install additional system dependencies if needed | |
RUN apt-get update && apt-get install -y \ | |
gconf-service \ | |
libasound2 \ | |
libatk1.0-0 \ | |
libcairo2 \ | |
libcups2 \ | |
libfontconfig1 \ | |
libgdk-pixbuf2.0-0 \ | |
libgtk-3-0 \ | |
libnspr4 \ | |
libpango-1.0-0 \ | |
libxss1 \ | |
fonts-liberation \ | |
libappindicator1 \ | |
libnss3 \ | |
lsb-release \ | |
xdg-utils \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Playwright and its dependencies | |
RUN playwright install --with-deps chromium | |
# Copy the current directory contents into the container | |
COPY . . | |
# Ensure the correct permissions for the application directory | |
RUN chmod -R 755 /app | |
# Expose the port the app runs on | |
EXPOSE 8000 | |
# Command to run the FastAPI application | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |