From 899d90424e955b6a9c609280975c2ea3bff0ed41 Mon Sep 17 00:00:00 2001 From: Alexander PapaTutuWawa Date: Mon, 21 Apr 2025 16:15:34 +0200 Subject: [PATCH] Add a Containerfile --- .dockerignore | 9 +++++++++ Containerfile | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .dockerignore create mode 100644 Containerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7e61cb6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +prosody/ +config.yaml +db.sqlite3 +prosody.cfg.lua +.woodpecker/ +.ruff_cache/ +.venv/ +.ropeproject/ +.mypy_cache/ diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..7d09a65 --- /dev/null +++ b/Containerfile @@ -0,0 +1,19 @@ +FROM ghcr.io/astral-sh/uv:python3.13-alpine as builder +ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0 +WORKDIR /app +ADD . /app +RUN apk add --no-cache cargo git && \ + uv sync --frozen --no-install-project --no-dev +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --frozen --no-dev + +FROM python:3.13-alpine3.20 +# slixmpp requires libgcc +RUN apk add --no-cache libgcc + +# Install the application +COPY --from=builder /app /app +WORKDIR /app +ENV PATH="/app/.venv/bin:$PATH" + +CMD ["/app/.venv/bin/fastapi", "run", "src/xmpp_api/main.py", "--port", "8080"]