контейнеризация для 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
|
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
|
FROM base as development
|
||||||
|
|
||||||
RUN pip install uv
|
RUN pip install uv
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
services:
|
services:
|
||||||
|
agent:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
target: production
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
restart: unless-stopped
|
||||||
|
profiles:
|
||||||
|
- production
|
||||||
|
|
||||||
agent-dev:
|
agent-dev:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue