Update Dockerfile
Browse files- Dockerfile +44 -10
Dockerfile
CHANGED
|
@@ -1,9 +1,36 @@
|
|
| 1 |
FROM vectorim/element-web:latest
|
| 2 |
|
| 3 |
-
#
|
| 4 |
USER root
|
| 5 |
|
| 6 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
RUN echo 'worker_processes 1; \
|
| 8 |
pid /tmp/nginx.pid; \
|
| 9 |
events { worker_connections 1024; } \
|
|
@@ -18,6 +45,13 @@ http { \
|
|
| 18 |
server { \
|
| 19 |
listen 7860; \
|
| 20 |
server_name localhost; \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
location / { \
|
| 22 |
root /app; \
|
| 23 |
index index.html; \
|
|
@@ -26,18 +60,18 @@ http { \
|
|
| 26 |
} \
|
| 27 |
}' > /etc/nginx/nginx.conf
|
| 28 |
|
| 29 |
-
#
|
| 30 |
RUN rm -rf /docker-entrypoint.d/*
|
| 31 |
|
| 32 |
-
#
|
| 33 |
RUN chmod -R 777 /tmp /var/cache/nginx /var/run /var/log/nginx
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# COPY config.json /app/config.json
|
| 39 |
-
# COPY logo.png /app/res/themes/element/img/logos/facebook-logo.png
|
| 40 |
|
|
|
|
| 41 |
EXPOSE 7860
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
| 1 |
FROM vectorim/element-web:latest
|
| 2 |
|
| 3 |
+
# Passer root
|
| 4 |
USER root
|
| 5 |
|
| 6 |
+
# Installer PostgreSQL 16 et les dépendances de Synapse
|
| 7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
postgresql-16 \
|
| 9 |
+
python3-pip \
|
| 10 |
+
libpq-dev \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Installer Synapse (dernière version)
|
| 14 |
+
RUN pip3 install --no-cache-dir matrix-synapse
|
| 15 |
+
|
| 16 |
+
# Créer les répertoires persistants dans /data
|
| 17 |
+
RUN mkdir -p /data/postgres /data/synapse && chown -R postgres:postgres /data/postgres
|
| 18 |
+
|
| 19 |
+
# Initialiser le cluster PostgreSQL (une seule fois)
|
| 20 |
+
# Cette commande sera exécutée à chaque build, mais elle vérifie si le répertoire existe déjà
|
| 21 |
+
RUN if [ ! -f "/data/postgres/PG_VERSION" ]; then \
|
| 22 |
+
su - postgres -c "/usr/lib/postgresql/16/bin/initdb -D /data/postgres"; \
|
| 23 |
+
echo "host all all 127.0.0.1/32 md5" >> /data/postgres/pg_hba.conf; \
|
| 24 |
+
echo "listen_addresses='localhost'" >> /data/postgres/postgresql.conf; \
|
| 25 |
+
fi
|
| 26 |
+
|
| 27 |
+
# Copier nos fichiers de configuration
|
| 28 |
+
COPY synapse/homeserver.yaml /data/synapse/homeserver.yaml
|
| 29 |
+
COPY synapse/log.config /data/synapse/log.config
|
| 30 |
+
COPY config.json /app/config.json # votre config Element (déjà faite)
|
| 31 |
+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
| 32 |
+
|
| 33 |
+
# Configurer Nginx (votre bloc serveur modifié)
|
| 34 |
RUN echo 'worker_processes 1; \
|
| 35 |
pid /tmp/nginx.pid; \
|
| 36 |
events { worker_connections 1024; } \
|
|
|
|
| 45 |
server { \
|
| 46 |
listen 7860; \
|
| 47 |
server_name localhost; \
|
| 48 |
+
location /_matrix { \
|
| 49 |
+
proxy_pass http://localhost:8008; \
|
| 50 |
+
proxy_set_header Host $host; \
|
| 51 |
+
proxy_set_header X-Forwarded-For $remote_addr; \
|
| 52 |
+
proxy_set_header X-Forwarded-Proto $scheme; \
|
| 53 |
+
client_max_body_size 50M; \
|
| 54 |
+
} \
|
| 55 |
location / { \
|
| 56 |
root /app; \
|
| 57 |
index index.html; \
|
|
|
|
| 60 |
} \
|
| 61 |
}' > /etc/nginx/nginx.conf
|
| 62 |
|
| 63 |
+
# Supprimer les scripts d'entrée d'origine
|
| 64 |
RUN rm -rf /docker-entrypoint.d/*
|
| 65 |
|
| 66 |
+
# Permissions pour les dossiers temporaires
|
| 67 |
RUN chmod -R 777 /tmp /var/cache/nginx /var/run /var/log/nginx
|
| 68 |
|
| 69 |
+
# Créer l'utilisateur synapse dans PostgreSQL (sera fait au démarrage via un script)
|
| 70 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 71 |
+
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
USER 1000
|
| 74 |
EXPOSE 7860
|
| 75 |
|
| 76 |
+
ENTRYPOINT ["/entrypoint.sh"]
|
| 77 |
+
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|