Spaces:
Build error
Build error
FROM python:3.10 | |
# --------------------------- | |
# 1. System dependencies | |
# --------------------------- | |
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 | |
# --------------------------- | |
# 2. Set up Poetry in /usr/local | |
# --------------------------- | |
ENV POETRY_HOME="/usr/local/poetry" | |
RUN curl -sSL https://install.python-poetry.org | python3 - --yes | |
# Add Poetry to PATH | |
ENV PATH="$POETRY_HOME/bin:$PATH" | |
# --------------------------- | |
# 3. Copy files & install deps | |
# --------------------------- | |
WORKDIR /code | |
# Copy only dependency files first for Docker caching | |
COPY pyproject.toml poetry.lock /code/ | |
# Install dependencies | |
RUN poetry install --no-root --no-interaction --no-ansi | |
# Copy the rest of the project | |
COPY . /code | |
# --------------------------- | |
# 4. If you need a non-root user | |
# --------------------------- | |
# (Optional) Create a non-root user | |
RUN useradd -m -u 1000 user | |
RUN chown -R user:user /code | |
USER user | |
# --------------------------- | |
# 5. Expose & run | |
# --------------------------- | |
EXPOSE 7860 | |
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |