From 5168b042a0bc6171724a4dae3c6a61d934e28f6e Mon Sep 17 00:00:00 2001
From: Pierre-Gilles Levallois <pierregilles.levallois@gmail.com>
Date: Fri, 14 Oct 2022 15:38:38 +0200
Subject: [PATCH] just another test more & more

---
 Dockerfiles/db/Dockerfile | 36 +++++++++++++++---------------------
 deployment/db-calqul.yml  |  5 +++--
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/Dockerfiles/db/Dockerfile b/Dockerfiles/db/Dockerfile
index 9ffe08c..3d67b8c 100644
--- a/Dockerfiles/db/Dockerfile
+++ b/Dockerfiles/db/Dockerfile
@@ -1,32 +1,26 @@
-# # ARB::Base de données postgis pour le calcul du calque de plantabilité
+# ARB::Base de données postgis pour le calcul du calque de plantabilité
 
-# FROM postgis/postgis
+FROM postgis/postgis
 
-# # Create another dir for pgdata than /var/postgresql/data/
-# # see http://heidloff.net/article/deploying-postgres-on-openshift/
-# USER root
+# Create another dir for pgdata than /var/postgresql/data/
+# see http://heidloff.net/article/deploying-postgres-on-openshift/
+USER root
 
 # ENV PGDATA=/var/lib/postgresql/data/pgdata
-# # RUN mkdir arb-data
+ENV PGDATA=/arb-data/pgdata
 # RUN groupadd non-root-postgres-group && \
 # useradd non-root-postgres-user --group non-root-postgres-group && \
-# mkdir -p $PGDATA && \
-# chown -R non-root-postgres-user:non-root-postgres-group /$PGDATA && \
-# chmod 777 /$PGDATA
-
-# # Entry point. 
-# COPY ./db-init/ /docker-entrypoint-initdb.d/
+RUN mkdir -p $PGDATA && \
+chown -R postgres:0 /$PGDATA && \
+chmod 777 /$PGDATA
 
-# RUN ls -l /docker-entrypoint-initdb.d/
+# Entry point. 
+COPY ./db-init/ /docker-entrypoint-initdb.d/
 
 # USER non-root-postgres
 
-FROM mdillon/postgis:10-alpine
-
-USER root
-
-RUN chown postgres:0 -R ${PGDATA}
-
-COPY ./db-init/ /docker-entrypoint-initdb.d/
-
+# FROM mdillon/postgis:10-alpine
+# USER root
+# RUN chown postgres:0 -R ${PGDATA}
+# COPY ./db-init/ /docker-entrypoint-initdb.d/
 USER postgres
\ No newline at end of file
diff --git a/deployment/db-calqul.yml b/deployment/db-calqul.yml
index 904a716..008ca0b 100644
--- a/deployment/db-calqul.yml
+++ b/deployment/db-calqul.yml
@@ -64,7 +64,8 @@ spec:
           value: "__POSTGRES_SCHEMA__"
           # need to define PGDATA env var because not using the default /var/lib/postgresql/data, but a subpath under it.
         - name: PGDATA
-          value: /var/lib/postgresql/data/pgdata
+          # value: /var/lib/postgresql/data/pgdata
+          value: /arb-data/pgdata
         volumeMounts:
           # need a subpath as postgres wants an empty folder (the mounted folder `/var/lib/postgresql/data` has a `lost+found` directory)
           # see https://stackoverflow.com/questions/51168558/how-to-mount-a-postgresql-volume-using-aws-ebs-in-kubernete
@@ -72,6 +73,6 @@ spec:
           # the owner:group of this folder is 70:70 (postgres:postgres), done by this step in the docker image:
           # https://github.com/docker-library/postgres/blob/master/Dockerfile-alpine.template#L146
           - name: db-data
-            mountPath: "/var/lib/postgresql/data/pgdata"
+            mountPath: "/arb-data/pgdata"
             subpath: pgdata
 
-- 
GitLab