From d9a418c60469b772c561e99445f9d3fd905f224a Mon Sep 17 00:00:00 2001 From: Daniel-I-Am Date: Thu, 2 Sep 2021 23:35:10 +0200 Subject: [PATCH] Add a Dockerfile for deployments --- .dockerignore | 15 +++++++++++++++ Dockerfile | 30 ++++++++++++++++++++++++++++++ apache-host.conf | 16 ++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 apache-host.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cb45176 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +/node_modules +/public/css +/public/fonts +/public/js +/public/mix-manifest.json +/storage +!/storage/app/public/.gitignore +!/storage/framework/.gitignore +!/storage/framework/cache/.gitignore +!/storage/framework/cache/data/.gitignore +!/storage/framework/sessions/.gitignore +!/storage/framework/views/.gitignore +!/storage/logs/.gitignore +/tests +/vendor diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d619544 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM php:apache-buster + +COPY . /app +COPY ./apache-host.conf /etc/apache2/conf-enabled/project.conf + +WORKDIR /app + +RUN a2enmod rewrite + +RUN apt-get update && \ + apt-get install -y libzip-dev && \ + docker-php-ext-install zip && \ + docker-php-ext-install pdo pdo_mysql && \ + apt-get install -y curl dirmngr apt-transport-https lsb-release ca-certificates && \ + curl -sL https://deb.nodesource.com/setup_12.x | bash - && \ + apt-get install -y nodejs && \ + rm -rf /var/lib/apt/lists/* + +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ + php composer-setup.php && \ + php -r "unlink('composer-setup.php');" && \ + ./composer.phar install --no-dev + +RUN npm install --global yarn && \ + yarn && \ + yarn prod && \ + rm -rf node_modules/ + +RUN find storage -type d -exec chmod 777 {} \; && \ + find storage -type f -exec chmod 666 {} \; \ diff --git a/apache-host.conf b/apache-host.conf new file mode 100644 index 0000000..f5def9f --- /dev/null +++ b/apache-host.conf @@ -0,0 +1,16 @@ + + DocumentRoot /app/public + DirectoryIndex index.php + + + Options FollowSymLinks MultiViews + AllowOverride All + RewriteEngine On + Require all granted + Order allow,deny + Allow from all + + + ErrorLog /dev/stderr + Customlog /dev/stdout combined +