Spaces:
Build error
Build error
File size: 971 Bytes
d5c46e9 f2db274 7202336 525b80a 2476522 e8de95e 525b80a f2db274 d5c46e9 525b80a d5c46e9 525b80a 2476522 525b80a d5c46e9 525b80a c633b82 525b80a 2476522 525b80a 2476522 525b80a c13745d 525b80a 7202336 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
FROM python:3.10
# 1. System dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0
# 2. Install Poetry into /usr/local/poetry
ENV POETRY_HOME="/usr/local/poetry"
RUN curl -sSL https://install.python-poetry.org | python3 - --yes
# Put Poetry on PATH
ENV PATH="$POETRY_HOME/bin:$PATH"
# 3. Create a non-root user
RUN useradd -m -u 1000 user
# 4. Create /code folder and set ownership
RUN mkdir /code && chown user:user /code
# 5. Switch to that user BEFORE installing dependencies
WORKDIR /code
USER user
# 6. Copy only the dependency files first
COPY --chown=user:user pyproject.toml poetry.lock /code/
# 7. Install dependencies as the non-root user
RUN poetry install --no-root --no-interaction --no-ansi
# 8. Copy the rest of your source code
COPY --chown=user:user . /code
# 9. Expose your port
EXPOSE 7860
# 10. Launch your app with Poetry
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|