first commit
All checks were successful
Build Docker Image / build-and-deploy-image (push) Successful in 38s

This commit is contained in:
2024-10-13 09:26:56 +03:00
commit cd1d9b4be0
8 changed files with 422 additions and 0 deletions

26
Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
FROM ghcr.io/astral-sh/uv:python3.12-alpine AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
WORKDIR /app
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project --no-dev
COPY pyproject.toml uv.lock /app/
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
FROM python:3.12-alpine
WORKDIR /app
# hadolint ignore=DL3018
RUN apk add --no-cache tini
ENV PATH="/app/.venv/bin:$PATH"
COPY --from=builder /app /app
COPY app.py /app/
EXPOSE 8000
ENTRYPOINT ["tini", "--"]
CMD ["granian", "--workers", "1", "--host", "0.0.0.0", "--interface", "asgi", "app:app"]