Skip to content

Instantly share code, notes, and snippets.

@diegomengarda
Last active February 28, 2018 16:25
Show Gist options
  • Save diegomengarda/396d5c7ad23d6fe2521199f091297fb0 to your computer and use it in GitHub Desktop.
Save diegomengarda/396d5c7ad23d6fe2521199f091297fb0 to your computer and use it in GitHub Desktop.
version: '2'
networks:
laravel:
driver: bridge
services:
postgres:
image: postgres:10.2
container_name: laravel-postgres
volumes:
- ./database:/postgres-data:rw
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- PGDATA=/postgres-data
networks:
laravel:
php:
image: my/php
container_name: laravel-php
volumes:
- ./root:/app:rw
links:
- postgres
networks:
laravel:
app:
image: my/nginx
container_name: laravel-nginx
volumes:
- ./root:/app:rw
- ./conf/nginx.conf:/etc/nginx/conf.d/default.conf:rw
links:
- php
networks:
laravel:
ports:
- "8090:80"
server {
listen 80;
server_name _;
root /app/public;
index index.php index.html index.htm;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/.+\.php(/|$) {
fastcgi_pass laravel-php:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
FROM nginx:latest
RUN useradd -ms /bin/bash laravel
RUN mkdir /app && \
chown -R laravel:laravel /app && \
chmod -R 775 /app
RUN sed -i "s/user nginx;/user laravel laravel;/" /etc/nginx/nginx.conf
FROM php:7.1-fpm
RUN apt-get update && \
apt-get install -y libpq-dev libmcrypt-dev libldb-dev libldap2-dev libpng-dev libxml2-dev libcurl4-gnutls-dev librtmp-dev libicu-dev
RUN ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pdo_pgsql pgsql pdo_mysql ldap gd zip mcrypt intl
RUN useradd -ms /bin/bash laravel
RUN mkdir /app && \
chown -R laravel:laravel /app && \
chmod -R 775 /app
RUN sed -i "s/user = www-data/user = laravel/" /usr/local/etc/php-fpm.d/www.conf && \
sed -i "s/group = www-data/group = laravel/" /usr/local/etc/php-fpm.d/www.conf && \
sed -i "s/;listen.owner = www-data/listen.owner = laravel/" /usr/local/etc/php-fpm.d/www.conf && \
sed -i "s/;listen.group = laravel/listen.group = laravel/" /usr/local/etc/php-fpm.d/www.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment