контейнеризация для production
This commit is contained in:
parent
bece7ab23b
commit
98f51e5210
2 changed files with 36 additions and 0 deletions
24
Dockerfile
24
Dockerfile
|
|
@ -5,6 +5,30 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
FROM base as builder
|
||||
|
||||
RUN apt update && apt install git -y
|
||||
RUN pip install uv
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --frozen --no-install-project --no-dev
|
||||
RUN uv pip install git+https://git.lambda.coredump.ru/platform/agent_api.git
|
||||
|
||||
FROM base as production
|
||||
|
||||
RUN useradd --create-home --shell /bin/bash appuser
|
||||
|
||||
COPY --from=builder /app/.venv /app/.venv
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
COPY src/ /app/src/
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
FROM base as development
|
||||
|
||||
RUN pip install uv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue