-
-
Save aabeben/ec4328d8c48ee1f24ac36879a3e679eb to your computer and use it in GitHub Desktop.
Laravel development Docker setup using PHP 8+, Apache, MySql 8+, PhpMyAdmin and Mailhog. Includes relevant application Dockerfile and the Compose file. [Imagick edition]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
# Application & web server | |
app: | |
build: | |
context: . | |
working_dir: /var/www | |
volumes: | |
- ./:/var/www | |
depends_on: | |
- "database" | |
ports: | |
- 80:80 | |
# Database | |
database: | |
image: mysql:8.0 | |
volumes: | |
- dbdata:/var/lib/mysql | |
environment: | |
MYSQL_DATABASE: ${DB_DATABASE} | |
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} | |
MYSQL_PASSWORD: ${DB_PASSWORD} | |
MYSQL_USER: ${DB_USERNAME} | |
ports: | |
- "33061:3306" | |
# Database management | |
pma: | |
image: phpmyadmin:5.1 | |
environment: | |
- PMA_ARBITRARY=1 | |
- PMA_HOST=${DB_HOST} | |
- PMA_USER=${DB_USERNAME} | |
- PMA_PASSWORD=${DB_PASSWORD} | |
- PMA_PORT=${DB_PORT} | |
depends_on: | |
- database | |
ports: | |
- 8888:80 | |
# Mailing Server | |
mailhog: | |
image: mailhog/mailhog | |
logging: | |
driver: 'none' | |
ports: | |
- 1025:1025 | |
- 8025:8025 | |
volumes: | |
dbdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:8.0-apache | |
RUN apt-get update && apt-get install -y \ | |
libmagickwand-dev \ | |
--no-install-recommends \ | |
&& pecl install imagick \ | |
&& docker-php-ext-enable imagick opcache \ | |
&& docker-php-ext-install pdo_mysql \ | |
&& apt-get autoclean -y \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Update apache conf to point to application public directory | |
ENV APACHE_DOCUMENT_ROOT=/var/www/public | |
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | |
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | |
# Update uploads config | |
RUN echo "file_uploads = On\n" \ | |
"memory_limit = 1024M\n" \ | |
"upload_max_filesize = 512M\n" \ | |
"post_max_size = 512M\n" \ | |
"max_execution_time = 1200\n" \ | |
> /usr/local/etc/php/conf.d/uploads.ini | |
# Enable headers module | |
RUN a2enmod rewrite headers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment