Build postgres using dockerfile

- use dockerfile to install postgis during build
This commit is contained in:
Sam 2024-07-06 10:26:08 +01:00
parent ba19ee9125
commit 3dbe85853e
1 changed files with 9 additions and 1 deletions

View File

@ -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";