Skip to content

Instantly share code, notes, and snippets.

@martincarlin87
Last active March 25, 2019 02:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save martincarlin87/901780a1ecdcd4dbd7e222202e223dd7 to your computer and use it in GitHub Desktop.
Save martincarlin87/901780a1ecdcd4dbd7e222202e223dd7 to your computer and use it in GitHub Desktop.
An attempt to Dockerise an existing Laravel App.
version: '2'
services:
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./:/var/www/test
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ./:/var/www/test
- ./php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini
links:
- mysql
mysql:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_DATABASE=db_name
- MYSQL_USER=root
- MYSQL_PASSWORD=
- MYSQL_ALLOW_EMPTY_PASSWORD=true
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
nano \
php7.1-mysql php-redis php7.1-gd php-imagick php-ssh2 php-xdebug \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
RUN docker-php-ext-install pdo pdo_mysql
WORKDIR /var/www/test
RUN cd /var/www/test && \
composer install --no-interaction
EXPOSE 80
EXPOSE 443
upload_max_filesize = 100M
post_max_size = 108M
server {
listen 80;
server_name test.localhost;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /var/www/test/public;
index index.php;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/error.log";
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment