From 944b6b0526032ad8c1b4a2612d6723bec75e0e4c Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 29 Mar 2024 22:29:56 -0400 Subject: start database (user and post), and initial barebones home page --- build/postgrest/Dockerfile | 9 +++++++++ build/postgrest/entrypoint.sh | 20 ++++++++++++++++++++ build/postgrest/postgrest.tar.xz | Bin 0 -> 3648348 bytes 3 files changed, 29 insertions(+) create mode 100644 build/postgrest/Dockerfile create mode 100755 build/postgrest/entrypoint.sh create mode 100644 build/postgrest/postgrest.tar.xz (limited to 'build/postgrest') diff --git a/build/postgrest/Dockerfile b/build/postgrest/Dockerfile new file mode 100644 index 0000000..62b8a2e --- /dev/null +++ b/build/postgrest/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:3.19 +COPY ./postgrest.tar.xz /tmp/postgrest.tar.xz +RUN tar xJf /tmp/postgrest.tar.xz -C /tmp +RUN mv /tmp/postgrest /usr/local/bin/postgrest +RUN rm /tmp/postgrest.tar.xz +COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh +CMD ["/usr/local/bin/entrypoint.sh"] + + diff --git a/build/postgrest/entrypoint.sh b/build/postgrest/entrypoint.sh new file mode 100755 index 0000000..d375769 --- /dev/null +++ b/build/postgrest/entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +mkdir /etc/postgrest.d +config=/etc/postgrest.d/postgrest.conf + +PGRST_DB_URI="postgres://authenticator:postgrest@db:5432/$POSTGRES_DB" +PGRST_ROLE="rest_anon" +PGRST_SCHEMA="api" + +rm -fr "$config" +touch "$config" +printf 'db-uri = "%s"\n' "$PGRST_DB_URI" >> $config +printf 'db-anon-role = "%s"\n' "$PGRST_ROLE" >> $config +printf 'db-schemas = "%s"\n' "$PGRST_SCHEMA" >> $config +printf 'jwt-secret = "%s"\n' "$JWT_SECRET" >> $config +printf 'jwt-secret-is-base64 = false\n' >> $config +printf 'server-host = "*"\n' >> $config +printf 'server-port = 3000\n' >> $config + +exec /usr/local/bin/postgrest $config diff --git a/build/postgrest/postgrest.tar.xz b/build/postgrest/postgrest.tar.xz new file mode 100644 index 0000000..33c2b2d Binary files /dev/null and b/build/postgrest/postgrest.tar.xz differ -- cgit v1.2.3-freya