Stuff
This commit is contained in:
parent
284400784a
commit
ea6d0eea7c
8 changed files with 112 additions and 5 deletions
|
@ -9,11 +9,11 @@ LOG_CHANNEL=stack
|
|||
LOG_SLACK_WEBHOOK_URL=
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_HOST=mariadb
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=homestead
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secret
|
||||
DB_DATABASE=dev
|
||||
DB_USERNAME=dev
|
||||
DB_PASSWORD=dev
|
||||
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
|
|
30
docker-compose.yml
Normal file
30
docker-compose.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
version: '3.2'
|
||||
services:
|
||||
php:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: docker/Dockerfile-fpm
|
||||
volumes:
|
||||
- ./:/app
|
||||
links:
|
||||
- mariadb
|
||||
nginx:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: docker/Dockerfile-nginx
|
||||
volumes:
|
||||
- ./:/app
|
||||
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
ports:
|
||||
- 8083:80
|
||||
links:
|
||||
- php
|
||||
mariadb:
|
||||
image: mariadb:10.4.4
|
||||
ports:
|
||||
- 3306:3306
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: example
|
||||
MYSQL_DATABASE: dev
|
||||
MYSQL_USER: dev
|
||||
MYSQL_PASSWORD: dev
|
8
docker/Dockerfile-fpm
Normal file
8
docker/Dockerfile-fpm
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM php:7.3.5-fpm-alpine3.9
|
||||
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./ /app
|
||||
|
||||
CMD ["sh", "/app/docker/start-fpm.sh"]
|
4
docker/Dockerfile-nginx
Normal file
4
docker/Dockerfile-nginx
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM nginx:1.15.12-alpine
|
||||
|
||||
COPY ./ /app
|
||||
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
|
21
docker/nginx.conf
Normal file
21
docker/nginx.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
server {
|
||||
index index.php index.html;
|
||||
server_name php-docker.local;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
root /app/public;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =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;
|
||||
}
|
||||
}
|
10
docker/start-fpm.sh
Normal file
10
docker/start-fpm.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
cd /app
|
||||
until nc -z -v -w30 mariadb 3306
|
||||
do
|
||||
echo "Waiting for database connection..."
|
||||
# wait for 5 seconds before check again
|
||||
sleep 5
|
||||
done
|
||||
sleep 5
|
||||
php artisan migrate --force
|
||||
php-fpm
|
33
resources/views/index.php
Normal file
33
resources/views/index.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://bootswatch.com/4/sketchy/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4">
|
||||
<a class="navbar-brand" href="#">Top navbar</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="form-inline mt-2 mt-md-0">
|
||||
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
</body>
|
||||
</html>
|
|
@ -12,5 +12,6 @@
|
|||
*/
|
||||
|
||||
$router->get('/', function () use ($router) {
|
||||
return $router->app->version();
|
||||
return view('index', ['name' => 'James']);
|
||||
#return $router->app->version();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue