контейнеризация для production

This commit is contained in:
Егор Кандрушин 2026-04-07 15:43:02 +03:00
parent bece7ab23b
commit 98f51e5210
2 changed files with 36 additions and 0 deletions

View file

@ -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

View file

@ -1,4 +1,16 @@
services:
agent:
build:
context: .
target: production
ports:
- "8000:8000"
env_file:
- .env
restart: unless-stopped
profiles:
- production
agent-dev:
build:
context: .