From 4f0a9aff04752f2198852091a392fc94cfe4fa55 Mon Sep 17 00:00:00 2001 From: "jokob.sk" Date: Fri, 15 Jul 2022 12:33:12 +1000 Subject: [PATCH] fixing permissions, simplyfying the start.sh script --- .env | 6 ++++++ Dockerfile | 6 ++---- docker-compose.yml | 15 +++++++++++++++ dockerfiles/start.sh | 10 +++++----- 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 .env create mode 100644 docker-compose.yml diff --git a/.env b/.env new file mode 100644 index 00000000..28cec6a7 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +#GLOBAL +APP_DATA_LOCATION=/path/to/docker_appdata +APP_CONFIG_LOCATION=/path/to/docker_config +LOGS_LOCATION=/path/to/logs + + diff --git a/Dockerfile b/Dockerfile index d2073362..48534d3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,9 +34,7 @@ RUN ln -s /home/pi/pialert/install/index.html /var/www/html/index.html \ EXPOSE 20211 -# https://github.com/rtsp/docker-lighttpd/blob/main/Dockerfile -# > this one maybe better? https://hub.docker.com/r/jitesoft/lighttpd -# Todo, refacto CMD so that we can run lighttpd and make it respond instant -# The above Dockerfile is doing this well, but i don't see why it isn't working for us +# it's easy for permissions set in Git to be overridden, so doing it manually +RUN chmod -R a+rxw /home/pi/pialert/ CMD ["/home/pi/pialert/dockerfiles/start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..81157c91 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3" +services: + pialert: + build: . + container_name: pialert_dev + network_mode: "host" + restart: always + volumes: + - ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config + - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db + - ${LOGS_LOCATION}/tmp:/home/pi/pialert/log + environment: + - TZ=France/Paris + - HOST_USER_ID=1036 + - HOST_USER_GID=1000 diff --git a/dockerfiles/start.sh b/dockerfiles/start.sh index aeba895a..01d1674e 100755 --- a/dockerfiles/start.sh +++ b/dockerfiles/start.sh @@ -1,8 +1,8 @@ #!/bin/sh /home/pi/pialert/dockerfiles/user-mapping.sh -# probably too broad permissions -chmod -R 755 /home/pi/pialert -chmod -R 755 /var/www/html/pialert -chmod -R o+w /home/pi/pialert/db + + +#chmod -R 755 /var/www/html/pialert +#chmod -R o+w /home/pi/pialert/db /etc/init.d/lighttpd start -service cron start && tail -f /dev/null \ No newline at end of file +cron -f