From bfd476ff83a2609fda00a5dceb3ae0210aa7f867 Mon Sep 17 00:00:00 2001
From: Igor WITZ <igor.witz@etu.utc.fr>
Date: Thu, 18 Oct 2018 14:39:10 +0200
Subject: [PATCH] corrections de bugs

---
 pica-etherpad/Dockerfile    | 10 +++++-----
 pica-etherpad/entrypoint.sh |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/pica-etherpad/Dockerfile b/pica-etherpad/Dockerfile
index 7c564e58..3c3e9c6b 100644
--- a/pica-etherpad/Dockerfile
+++ b/pica-etherpad/Dockerfile
@@ -32,7 +32,6 @@ RUN curl -SL https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.
     rm -Rf etherpad.zip etherpad-lite-${ETHERPAD_VERSION}/.git && \
     mv etherpad-lite-${ETHERPAD_VERSION}/* . && \
     mkdir -p src/templates && \
-    mkdir -p static && \
     bin/installDeps.sh && \
     rm settings.json && \
     npm install \
@@ -53,16 +52,16 @@ RUN curl -SL https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.
     git clone https://framagit.org/DeBugs/picasoft-etherpad-landing-page.git src/templates/picasoft-etherpad-landing-page && \
     git --git-dir=src/templates/picasoft-etherpad-landing-page/.git checkout ${ETHERPAD_LANDING_PAGE_VERSION} && \
     cp src/templates/picasoft-etherpad-landing-page/index.html src/templates/index.html && \
-    cp src/templates/picasoft-etherpad-landing-page/static/* static/ -r
+    cp src/templates/picasoft-etherpad-landing-page/static/* src/static/ -r
 
 
 # construction de l'image finale
 FROM base
 
-COPY entrypoint.sh /entrypoint.sh
+COPY entrypoint.sh /opt/etherpad-lite/entrypoint.sh
 RUN apt-get update && \
     apt-get install -y mysql-client && \
-    chmod +x /entrypoint.sh && \
+    chmod +x /opt/etherpad-lite/entrypoint.sh && \
     mkdir -p /opt/etherpad-lite && \
     chown -R node /opt/etherpad-lite && \
     usermod -d /opt/etherpad-lite node && \
@@ -71,7 +70,8 @@ RUN apt-get update && \
 # import des fichiers téléchargés dans l'image downloader
 COPY --from=downloader --chown=node /opt/etherpad-lite /opt/etherpad-lite/ 
 
-ENTRYPOINT ["/entrypoint.sh"]
+USER node
+ENTRYPOINT ["/opt/etherpad-lite/entrypoint.sh"]
 CMD /bin/bash -c "/opt/etherpad-lite/bin/run.sh"
 HEALTHCHECK CMD curl -s 127.0.0.1:${ETHERPAD_PORT:=8080}
 
diff --git a/pica-etherpad/entrypoint.sh b/pica-etherpad/entrypoint.sh
index a755617a..4ea208bc 100644
--- a/pica-etherpad/entrypoint.sh
+++ b/pica-etherpad/entrypoint.sh
@@ -39,9 +39,9 @@ if [ "$RESULT" != $ETHERPAD_DB_NAME ]; then
 	      -e "create database ${ETHERPAD_DB_NAME}"
 fi
 
-if [ ! -f settings.json ]; then
+if [ ! -f /opt/etherpad-lite/settings.json ]; then
 
-	cat <<- EOF > settings.json
+	cat <<- EOF > /opt/etherpad-lite/settings.json
 	{
 	  "title": "${ETHERPAD_TITLE}",
 	  "ip": "0.0.0.0",
@@ -60,7 +60,7 @@ if [ ! -f settings.json ]; then
 
 		: ${ETHERPAD_ADMIN_USER:=admin}
 
-		cat <<- EOF >> settings.json
+		cat <<- EOF >> /opt/etherpad-lite/settings.json
 		  "users": {
 		    "${ETHERPAD_ADMIN_USER}": {
 		      "password": "${ETHERPAD_ADMIN_PASSWORD}",
@@ -70,7 +70,7 @@ if [ ! -f settings.json ]; then
 		EOF
 	fi
 
-	cat <<- EOF >> settings.json
+	cat <<- EOF >> /opt/etherpad-lite/settings.json
 	}
 	EOF
 fi
-- 
GitLab