Spaces:
Runtime error
Runtime error
| FROM python:3.9 | |
| # Create a new user and group with UID/GID 1000 | |
| RUN groupadd -r myapp && useradd -r -g myapp -u 1000 myapp | |
| # Create the working directory and set the ownership to the new user and group | |
| RUN mkdir /app && chown myapp:myapp /app | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y libgl1 ffmpeg libsm6 libxext6 | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the code and set the ownership to the new user and group | |
| COPY . . | |
| RUN chown -R myapp:myapp . | |
| # Create the home directory for the myapp user | |
| RUN mkdir /home/myapp && chown myapp:myapp /home/myapp && chmod a+rwx /home/myapp | |
| # Switch to the new user | |
| USER myapp | |
| # Start the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |