Add a Dockerfile for deployments

This commit is contained in:
Daniel_I_Am 2021-09-02 23:35:10 +02:00
parent f17660715a
commit d9a418c604
3 changed files with 61 additions and 0 deletions

15
.dockerignore Normal file
View File

@ -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

30
Dockerfile Normal file
View File

@ -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 {} \; \

16
apache-host.conf Normal file
View File

@ -0,0 +1,16 @@
<VirtualHost *:80>
DocumentRoot /app/public
DirectoryIndex index.php
<Directory "/app/public">
Options FollowSymLinks MultiViews
AllowOverride All
RewriteEngine On
Require all granted
Order allow,deny
Allow from all
</Directory>
ErrorLog /dev/stderr
Customlog /dev/stdout combined
</VirtualHost>