From f794070ca12189bcfadb43164ce2e4fef173a24d Mon Sep 17 00:00:00 2001 From: Mihai Criveti Date: Tue, 27 May 2025 21:02:22 +0100 Subject: [PATCH] Add postgresql to container build --- Containerfile | 2 +- Containerfile.lite | 2 +- Makefile | 5 +++++ pyproject.toml | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index 06107f667..f097fd4cb 100644 --- a/Containerfile +++ b/Containerfile @@ -21,7 +21,7 @@ COPY . /app # Create virtual environment, upgrade pip and install dependencies using uv for speed RUN python3 -m venv /app/.venv && \ /app/.venv/bin/python3 -m pip install --upgrade pip setuptools pdm uv && \ - /app/.venv/bin/python3 -m uv pip install . + /app/.venv/bin/python3 -m uv pip install .[redis,postgres] # update the user permissions RUN chown -R 1001:0 /app && \ diff --git a/Containerfile.lite b/Containerfile.lite index 031a39035..47c5eb629 100644 --- a/Containerfile.lite +++ b/Containerfile.lite @@ -63,7 +63,7 @@ COPY . /app RUN set -euo pipefail \ && python3 -m venv /app/.venv \ && /app/.venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel pdm uv \ - && /app/.venv/bin/uv pip install . \ + && /app/.venv/bin/uv pip install .[redis,postgres] \ && rm -rf /root/.cache /var/cache/dnf # ---------------------------------------------------------------------------- diff --git a/Makefile b/Makefile index 03438a03b..a7fc20a68 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ os-deps: $(OS_DEPS_SCRIPT) # help: activate - Activate the virtual environment in the current shell # help: install - Install project into the venv # help: install-dev - Install project (incl. dev deps) into the venv +# help: install-db - Install project (incl. postgres and redis) into venv # help: update - Update all installed deps inside the venv .PHONY: venv venv: @@ -91,6 +92,10 @@ activate: install: venv @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m uv pip install ." +.PHONY: install-db +install-db: venv + @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m uv pip install .[redis,postgres]" + .PHONY: install-dev install-dev: venv @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m uv pip install .[dev]" diff --git a/pyproject.toml b/pyproject.toml index 799dcc4f7..8589575b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,10 @@ redis = [ "redis>=6.1.0", ] +postgres = [ + "psycopg2-binary>=2.9.10", +] + # Optional dependency groups (development) dev = [ "argparse-manpage>=4.6",