commit ae8e8cef3b1f83ed4c9161a312553583d27597e6
parent b89cb0cb672552550a9f633b6977fb27ea3f27bf
Author: William Lindholm <a22willi@student.his.se>
Date: Fri, 29 Mar 2024 17:23:33 +0100
Fixed file system permissions for linux.
Diffstat:
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,2 +1,3 @@
mysql-data
-LenaSYS
-\ No newline at end of file
+LenaSYS
+githubMetadata
+\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
@@ -20,8 +20,6 @@ RUN mkdir -p /var/www/html/temp && \
chown www-data:www-data /var/www/html/temp && \
git clone https://github.com/HGustavs/LenaSYS.git /var/www/html/temp
-RUN mkdir -p /var/www/html/githubMetadata
-
# Copy the initialization script
COPY init.sh /usr/local/bin/init.sh
diff --git a/docker-compose.yml b/docker-compose.yml
@@ -8,6 +8,7 @@ services:
volumes:
- "./LenaSYS:/var/www/html/LenaSYS"
- "./coursesyspw.php:/var/www/html/coursesyspw.php"
+ - "./githubMetadata:/var/www/html/githubMetadata"
restart: no
db:
image: mysql:5.7.42
diff --git a/init.sh b/init.sh
@@ -8,9 +8,14 @@ TEMP_PATH="/var/www/html/temp/*"
if [ ! "$(ls -A $REPO_PATH)" ]; then
echo "Directory is empty. Copying repository into ${REPO_PATH}..."
cp -r $TEMP_PATH $REPO_PATH
+ chown -R www-data:www-data $REPO_PATH
else
echo "Repository already exists or directory is not empty."
fi
+chown www-data:www-data /var/www/html/coursesyspw.php
+mkdir /var/www/html/githubMetadata
+chown -R www-data:www-data /var/www/html/githubMetadata
+
# Execute the main container command
exec "$@"