Skip to content

Instantly share code, notes, and snippets.

@zawyelwin
Created September 18, 2021 20:27
Show Gist options
  • Save zawyelwin/d1939e165b1790efef4d9c273a080574 to your computer and use it in GitHub Desktop.
Save zawyelwin/d1939e165b1790efef4d9c273a080574 to your computer and use it in GitHub Desktop.
Simple Laravel Docker Deployment
bootstrap/cache/services.php
storage/app/*
storage/framework/cache/*
storage/framework/sessions/*
storage/framework/views/*
storage/logs/*
vendor/
**/*node_modules
**.git
.idea
**.gitignore
**.gitattributes
**.sass-cache
.env
*.config.js
?ulpfile.js
?untfile.js
package.json
phpunit.xml
readme.md
phpspec.yml
Dockerfile
docker-compose.yml
run
run.ps1
FROM php:8.0.9-apache
RUN apt-get update && apt-get install -y \
zlib1g-dev \
libzip-dev \
libpng-dev
RUN docker-php-ext-install zip pdo_mysql gd mysqli opcache
RUN a2enmod rewrite
RUN mkdir /var/www/html/app
COPY vhost.conf /etc/apache2/sites-available/
COPY . /var/www/html/app
#Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#Download Vendor to dir app
WORKDIR /var/www/html/app
RUN composer install --no-interaction --optimize-autoloader --no-dev
RUN cp .env.example .env
RUN php artisan key:generate
#&& php artisan migrate --seed
#Permission
RUN chown -Rf www-data:www-data /var/www/html/app
RUN chmod -R 777 /var/www/html/app/storage
#Enable VHOST
RUN a2dissite 000-default.conf
RUN a2ensite vhost.conf
EXPOSE 80
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/app/public
<Directory "/var/www/html/app/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment