Skip to content

Instantly share code, notes, and snippets.

@vitorpacheco
Created March 24, 2018 21:02
Show Gist options
  • Save vitorpacheco/d07b4d5c11f7a18862cbef52463758ed to your computer and use it in GitHub Desktop.
Save vitorpacheco/d07b4d5c11f7a18862cbef52463758ed to your computer and use it in GitHub Desktop.
laravel-angular
server {
listen 80 default_server;
server_name php-docker.local;
index index.php index.html index.htm;
root /backend/public;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files $uri $uri/ /index.html;
# if ($request_method = 'OPTIONS') {
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# #
# # Custom headers and headers various browsers *should* be OK with but aren't
# #
# add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-XSRF-TOKEN';
# #
# # Tell client that this pre-flight info is valid for 20 days
# #
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
# return 204;
# }
# if ($request_method = 'POST') {
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-XSRF-TOKEN';
# add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
# }
# if ($request_method = 'GET') {
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-XSRF-TOKEN';
# add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
# }
}
location ~ \.php$ {
try_files $uri $uri/ /index.php?$query_string =404;
#try_files $uri $uri/ /index.html =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
web:
image: nginx:latest
ports:
- 8080:80
volumes:
- ./backend:/backend
- ./default.conf:/etc/nginx/conf.d/default.conf
links:
- php
composer:
image: composer:latest
volumes:
- ./backend:/app
command: install
php:
build: backend
volumes:
- ./backend:/backend
links:
- postgres
angular:
build: frontend
volumes:
- ./frontend:/frontend
ports:
- 4200:4200
postgres:
image: postgres:9.6
restart: always
ports:
- 5432:5432
environment:
LC_ALL: C.UTF-8
POSTGRES_DB: showcase
POSTGRES_USER: showcase
POSTGRES_PASSWORD: showcase
# vim:set ft=dockerfile:
# Create image based on the official Node 9.6.1 image from dockerhub
FROM php:7.2.2-fpm
# Install dependecies
RUN apt-get update && apt-get install -y \
zlib1g-dev \
libmemcached-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libpq-dev \
&& docker-php-source extract \
&& pecl install memcached-3.0.4 \
&& docker-php-ext-enable memcached \
&& docker-php-ext-install iconv \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd pdo pdo_pgsql \
&& docker-php-source delete
EXPOSE 9000
CMD ["php-fpm"]
# vim:set ft=dockerfile:
# Create image based on the official Node 9.6.1 image from dockerhub
FROM node:9.6.1
# Change directory so that our commands run inside this new directory
WORKDIR /frontend
# Install dependecies
RUN npm install
# Expose the port the app runs in
EXPOSE 4200
# Serve the app
CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment