LenaSYS-dockerenv

Log | Files | Refs | README | LICENSE

commit 6dd22117866ce2dd90d9a9d2136bab670cdd392f
parent 78f3c62026c1adbadd1f1c049cc2a7b03a8aaec6
Author: William Lindholm <william_lindholm@outlook.com>
Date:   Fri, 29 Mar 2024 12:49:25 +0100

Made it autoinstall everything.

Diffstat:
M.gitignore | 2++
MDockerfile | 23+++++++++++++++++++++--
Acoursesyspw.php | 7+++++++
Mdocker-compose.yml | 3++-
Ainit.sh | 16++++++++++++++++
5 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1 +1,2 @@ mysql-data +LenaSYS +\ No newline at end of file diff --git a/Dockerfile b/Dockerfile @@ -4,6 +4,7 @@ FROM php:8.0-apache RUN apt-get update && \ apt-get install -y \ libaio1 \ + git \ libsqlite3-dev \ libcurl4-openssl-dev \ && docker-php-ext-install pdo_mysql pdo_sqlite curl \ @@ -13,4 +14,22 @@ RUN apt-get update && \ RUN { \ echo 'upload_max_filesize=128M'; \ echo 'post_max_size=128M'; \ - } > /usr/local/etc/php/conf.d/uploads.ini -\ No newline at end of file + } > /usr/local/etc/php/conf.d/uploads.ini + +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 + +# Make sure the script is executable +RUN chmod +x /usr/local/bin/init.sh + +# Set the script as the entrypoint +ENTRYPOINT ["/usr/local/bin/init.sh"] + +# Default command +CMD ["apache2-foreground"] +\ No newline at end of file diff --git a/coursesyspw.php b/coursesyspw.php @@ -0,0 +1,6 @@ +<?php + define("DB_USER","lenasys"); + define("DB_PASSWORD","password"); + define("DB_HOST","db"); + define("DB_NAME","lenasysdb"); + ?> +\ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml @@ -6,7 +6,8 @@ services: ports: - "80:80" volumes: - - "../www:/var/www/" + - "./LenaSYS:/var/www/html/LenaSYS" + - "./coursesyspw.php:/var/www/html/coursesyspw.php" restart: no db: image: mysql:5.7.42 diff --git a/init.sh b/init.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Path to the directory where the repository should be +REPO_PATH="/var/www/html/LenaSYS" +TEMP_PATH="/var/www/html/temp/*" + +# Check if the directory is empty +if [ ! "$(ls -A $REPO_PATH)" ]; then + echo "Directory is empty. Copying repository into ${REPO_PATH}..." + cp -r $TEMP_PATH $REPO_PATH +else + echo "Repository already exists or directory is not empty." +fi + +# Execute the main container command +exec "$@"