Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM php:7.2-cli-stretch

8 changes: 8 additions & 0 deletions docker-compose-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "2"
services:
web:
image: composer
working_dir: /var/www/html
volumes:
- ".:/var/www/html"
command: composer install
17 changes: 17 additions & 0 deletions docker-compose-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "2"
services:
web:
image: nginx
ports:
- 5000:80
working_dir: /var/www/html
volumes:
- ".:/var/www/html"
- ./docker/site.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
php:
image: php:7.2-fpm-stretch
working_dir: /var/www/html
volumes:
- ".:/var/www/html"
18 changes: 18 additions & 0 deletions docker/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {
listen 80;
index index.php index.html;
server_name web;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;

location ~ \.php$ {
try_files $uri =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;
}
}
9 changes: 9 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
/**
* Rotas da API
*/
$app->get('/', function (Request $request, Response $response) use ($app) {
$response->getBody()->write("Root de Microservice!");
return $response;
});
$app->get('/bebe', function (Request $request, Response $response) use ($app) {
$response->getBody()->write("Bebê de Microservice!");
return $response;
});

require 'routes.php';

$app->run();