Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +15 -15
Dockerfile
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
# OMNIGROUP - POSTGRESQL CLOUD SOUVERAIN
|
| 3 |
# Infrastructure de Données de Haute Performance
|
| 4 |
# Spécial Hugging Face Spaces + Persistence
|
|
|
|
| 5 |
# ==========================================
|
| 6 |
|
| 7 |
FROM postgres:16-bookworm
|
|
@@ -12,36 +13,35 @@ USER root
|
|
| 12 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 13 |
POSTGRES_DB=nextcloud \
|
| 14 |
POSTGRES_USER=madiba_admin \
|
| 15 |
-
#
|
| 16 |
-
PGDATA=/
|
| 17 |
|
| 18 |
# 2. Configuration pour Hugging Face Spaces (Port 7860 exigé)
|
| 19 |
-
# PostgreSQL écoute par défaut sur 5432, on le redirige
|
| 20 |
RUN sed -i "s/#port = 5432/port = 7860/" /usr/share/postgresql/postgresql.conf.sample
|
| 21 |
|
| 22 |
-
# 3. Préparation du volume persistant
|
| 23 |
-
#
|
| 24 |
-
RUN mkdir -p /data/postgres_storage && \
|
| 25 |
-
chown -R postgres:postgres /data
|
| 26 |
-
chmod 700 /data/postgres_storage
|
| 27 |
|
| 28 |
-
# 4. Script d'Initialisation
|
| 29 |
RUN echo '#!/bin/bash\n\
|
| 30 |
set -e\n\
|
| 31 |
\n\
|
| 32 |
echo "[OMNIGROUP] Initialisation du moteur PostgreSQL..." \n\
|
| 33 |
\n\
|
| 34 |
-
#
|
| 35 |
-
|
|
|
|
| 36 |
\n\
|
| 37 |
-
# Si la base n existe pas, postgres l initialisera automatiquement dans PGDATA\n\
|
| 38 |
echo "[SYSTEM] Démarrage de PostgreSQL sur le port 7860..." \n\
|
| 39 |
exec docker-entrypoint.sh postgres -p 7860' > /usr/local/bin/run_postgres.sh && \
|
| 40 |
chmod +x /usr/local/bin/run_postgres.sh
|
| 41 |
|
| 42 |
-
# 5. Sécurité
|
| 43 |
-
#
|
| 44 |
-
RUN chown -R postgres:postgres /var/run/postgresql
|
| 45 |
|
| 46 |
USER postgres
|
| 47 |
|
|
|
|
| 2 |
# OMNIGROUP - POSTGRESQL CLOUD SOUVERAIN
|
| 3 |
# Infrastructure de Données de Haute Performance
|
| 4 |
# Spécial Hugging Face Spaces + Persistence
|
| 5 |
+
# Fix : Permission Denied sur /data
|
| 6 |
# ==========================================
|
| 7 |
|
| 8 |
FROM postgres:16-bookworm
|
|
|
|
| 13 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 14 |
POSTGRES_DB=nextcloud \
|
| 15 |
POSTGRES_USER=madiba_admin \
|
| 16 |
+
# On définit PGDATA directement dans le volume persistant
|
| 17 |
+
PGDATA=/data/postgres_storage/pgdata
|
| 18 |
|
| 19 |
# 2. Configuration pour Hugging Face Spaces (Port 7860 exigé)
|
|
|
|
| 20 |
RUN sed -i "s/#port = 5432/port = 7860/" /usr/share/postgresql/postgresql.conf.sample
|
| 21 |
|
| 22 |
+
# 3. Préparation du volume persistant (Phase ROOT)
|
| 23 |
+
# On crée toute l'arborescence ici pour que postgres en soit propriétaire
|
| 24 |
+
RUN mkdir -p /data/postgres_storage/pgdata && \
|
| 25 |
+
chown -R postgres:postgres /data && \
|
| 26 |
+
chmod -R 700 /data/postgres_storage
|
| 27 |
|
| 28 |
+
# 4. Script d'Initialisation Robuste
|
| 29 |
RUN echo '#!/bin/bash\n\
|
| 30 |
set -e\n\
|
| 31 |
\n\
|
| 32 |
echo "[OMNIGROUP] Initialisation du moteur PostgreSQL..." \n\
|
| 33 |
\n\
|
| 34 |
+
# Vérification des permissions au runtime par précaution\n\
|
| 35 |
+
# Si le dossier appartient à root, on ne pourra rien faire, \n\
|
| 36 |
+
# mais le build ci-dessus devrait régler le problème.\n\
|
| 37 |
\n\
|
|
|
|
| 38 |
echo "[SYSTEM] Démarrage de PostgreSQL sur le port 7860..." \n\
|
| 39 |
exec docker-entrypoint.sh postgres -p 7860' > /usr/local/bin/run_postgres.sh && \
|
| 40 |
chmod +x /usr/local/bin/run_postgres.sh
|
| 41 |
|
| 42 |
+
# 5. Sécurité
|
| 43 |
+
# On s'assure que les dossiers de socket sont accessibles
|
| 44 |
+
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
| 45 |
|
| 46 |
USER postgres
|
| 47 |
|