From 3dbe85853e590dddeb899905b9428988b562f57e Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 6 Jul 2024 10:26:08 +0100 Subject: [PATCH] Build postgres using dockerfile - use dockerfile to install postgis during build --- hosts/common/optional/docker/postgres.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hosts/common/optional/docker/postgres.nix b/hosts/common/optional/docker/postgres.nix index 8138b22..2b78fea 100644 --- a/hosts/common/optional/docker/postgres.nix +++ b/hosts/common/optional/docker/postgres.nix @@ -4,8 +4,16 @@ backend = "docker"; projects = { "db".settings.services."db".service = { - image = "postgres:16"; restart = "unless-stopped"; + build.context = "/nix/store"; + build.dockerfile = builtins.baseNameOf "${pkgs.writeScript "pgDockerfile" '' + FROM postgres:16 + # install packages + RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + postgresql-16-postgis \ + && rm -rf /var/lib/apt/lists/* + ''}"; environment = { POSTGRES_PASSWORD = "balls1234"; POSTGRES_USER = "admin";