From 5becefadcb28472403fe43b45ae4fe3d1652583d Mon Sep 17 00:00:00 2001 From: martmull Date: Thu, 2 Nov 2023 14:21:06 +0100 Subject: [PATCH] Add new Dockerfile for postgres (#2313) * Add new Dockerfile for postgres * Fix docker --------- Co-authored-by: Charles Bochet --- infra/build/postgres/Dockerfile | 14 ++++++++++---- infra/release/build-postgres.sh | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100755 infra/release/build-postgres.sh diff --git a/infra/build/postgres/Dockerfile b/infra/build/postgres/Dockerfile index 38560b3d7..e574f2d5f 100644 --- a/infra/build/postgres/Dockerfile +++ b/infra/build/postgres/Dockerfile @@ -1,11 +1,13 @@ -ARG PG_MAIN_VERSION=14 +ARG IMAGE_TAG='15.4.0-debian-11-r45' -FROM postgres:${PG_MAIN_VERSION} as postgres +FROM bitnami/postgresql:${IMAGE_TAG} -ARG PG_MAIN_VERSION +ARG PG_MAIN_VERSION=15 ARG PG_GRAPHQL_VERSION=1.3.0 ARG TARGETARCH +USER root + RUN set -eux; \ ARCH="$(dpkg --print-architecture)"; \ case "${ARCH}" in \ @@ -27,4 +29,8 @@ RUN apt update && apt install -y curl RUN curl -L "https://github.com/supabase/pg_graphql/releases/download/v${PG_GRAPHQL_VERSION}/pg_graphql-v${PG_GRAPHQL_VERSION}-pg${PG_MAIN_VERSION}-${TARGETARCH}-linux-gnu.deb" -o pg_graphql.deb RUN dpkg --install pg_graphql.deb -COPY ./infra/build/postgres/init.sql /docker-entrypoint-initdb.d/ \ No newline at end of file +COPY ./infra/build/postgres/init.sql /docker-entrypoint-initdb.d/ + +USER 1001 +ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/entrypoint.sh" ] +CMD [ "/opt/bitnami/scripts/postgresql/run.sh" ] \ No newline at end of file diff --git a/infra/release/build-postgres.sh b/infra/release/build-postgres.sh new file mode 100755 index 000000000..57159e631 --- /dev/null +++ b/infra/release/build-postgres.sh @@ -0,0 +1,6 @@ + +docker buildx build \ +--push \ +--no-cache \ +--platform linux/amd64,linux/arm64 \ +-f ./infra/build/postgres/Dockerfile -t twentycrm/twenty-postgres:0.2.0 -t twentycrm/twenty-postgres:latest .