From c1ef2d7070b184461f20ea2e382ce7cd594d4aae Mon Sep 17 00:00:00 2001 From: Eric Bus Date: Tue, 27 Feb 2024 12:06:38 +0100 Subject: [PATCH] chore: add docker local development files --- Dockerfile | 38 ++++++++++++++++++++ config/app.php | 2 +- docker-compose.yml | 10 ++++++ docker/apache.conf | 46 +++++++++++++++++++++++++ storage/app/.gitignore | 2 ++ storage/framework/cache/data/.gitignore | 2 ++ storage/framework/sessions/.gitignore | 2 ++ storage/framework/views/.gitignore | 2 ++ storage/logs/.gitignore | 2 ++ 9 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker/apache.conf create mode 100644 storage/app/.gitignore create mode 100644 storage/framework/cache/data/.gitignore create mode 100644 storage/framework/sessions/.gitignore create mode 100644 storage/framework/views/.gitignore create mode 100644 storage/logs/.gitignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..25380e43 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM php:8.1-apache + +RUN apt-get update \ + && apt-get -y install \ + g++ \ + libcurl4-gnutls-dev \ + libxml2-dev \ + libxslt-dev \ + libzip-dev \ + zlib1g-dev \ + msmtp \ + unzip \ + git \ + ssl-cert \ + locales \ + --no-install-recommends \ + && docker-php-ext-install pdo pdo_mysql mysqli xsl xml zip opcache \ + && a2enmod rewrite ssl proxy proxy_http headers \ + && apt-get purge -y g++ \ + && apt-get autoremove -y \ + && rm -r /var/lib/apt/lists/* + +# Get latest Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Update the default apache site with the config we created. +ADD docker/apache.conf /etc/apache2/sites-enabled/000-default.conf + +WORKDIR /var/www/html +COPY . /var/www/html + +RUN mkdir -p storage/framework/{sessions,views,cache,cache/data} && \ + chown -R www-data:www-data storage/framework && \ + chmod -R 775 storage + +# RUN php artisan cache:clear && \ +# php artisan config:clear && \ +# php artisan view:clear \ No newline at end of file diff --git a/config/app.php b/config/app.php index 6254f63f..324a80c5 100644 --- a/config/app.php +++ b/config/app.php @@ -105,7 +105,7 @@ return [ 'key' => env('APP_KEY'), - 'cipher' => 'AES-256-CBC', + 'cipher' => 'aes-256-cbc', /* |-------------------------------------------------------------------------- diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..7aa40de8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.8' + +services: + web: + build: ./ + ports: + - 8080:80 + - 8443:443 + volumes: + - .:/var/www/html \ No newline at end of file diff --git a/docker/apache.conf b/docker/apache.conf new file mode 100644 index 00000000..48de3180 --- /dev/null +++ b/docker/apache.conf @@ -0,0 +1,46 @@ +Header set X-Content-Type-Options: "nosniff" +Header set X-Frame-Options: "sameorigin" + +ServerTokens Prod + + + ServerName localhost + ServerAdmin support@websight.nl + DocumentRoot /var/www/html/public + + + Options -Indexes +FollowSymLinks +MultiViews + AllowOverride All + Order deny,allow + Allow from all + + + ErrorLog /var/log/apache2/vhost-error.log + CustomLog /var/log/apache2/vhost-access.log combined + + + + + ServerName localhost + ServerAdmin support@websight.nl + DocumentRoot /var/www/html/public + + SSLEngine on + SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem + SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key + SSLCompression off + SSLProtocol All -SSLv2 -SSLv3 + SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH + + + Options -Indexes +FollowSymLinks +MultiViews + AllowOverride All + Order deny,allow + Allow from all + + + ErrorLog /var/log/apache2/ssl-vhost-error.log + CustomLog /var/log/apache2/ssl-vhost-access.log combined + + + diff --git a/storage/app/.gitignore b/storage/app/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/app/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/framework/cache/data/.gitignore b/storage/framework/cache/data/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/framework/cache/data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/framework/sessions/.gitignore b/storage/framework/sessions/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/framework/sessions/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/framework/views/.gitignore b/storage/framework/views/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/framework/views/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file