Initial commit
This commit is contained in:
6
docker/.env.example
Normal file
6
docker/.env.example
Normal file
@ -0,0 +1,6 @@
|
||||
APP_ENV = "docker"
|
||||
DOCKER_APP_PORT = 8000
|
||||
DOCKER_DB_PORT = 3306
|
||||
DOCKER_DB_USERNAME = dbadmin
|
||||
DOCKER_DB_PASSWORD = secret
|
||||
DB_DATABASE = ttp
|
11
docker/Dockerfile
Normal file
11
docker/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM nginx:latest as nginx
|
||||
|
||||
FROM php:8-fpm as php-fpm
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y libmariadb-dev
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
|
||||
FROM php:8-apache as apache
|
||||
RUN a2enmod ssl && a2enmod rewrite
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
WORKDIR /var/www/html
|
11
docker/apache.conf
Normal file
11
docker/apache.conf
Normal file
@ -0,0 +1,11 @@
|
||||
ServerName localhost
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin admin@localhost
|
||||
DocumentRoot /var/www/html/
|
||||
<Directory /var/www/html/>
|
||||
DirectoryIndex index.php
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
87
docker/docker-compose.yml
Normal file
87
docker/docker-compose.yml
Normal file
@ -0,0 +1,87 @@
|
||||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
|
||||
services:
|
||||
# Database Server
|
||||
database:
|
||||
container_name: TTP-MySQL
|
||||
image: mysql:8.0
|
||||
ports:
|
||||
- ${DOCKER_DB_PORT}:3306
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${DOCKER_DB_PASSWORD}
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DOCKER_DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DOCKER_DB_PASSWORD}
|
||||
volumes:
|
||||
- db-data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping"]
|
||||
interval: 5s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
|
||||
phpmyadmin:
|
||||
container_name: TTP-PhpMyAdmin
|
||||
image: phpmyadmin:latest
|
||||
ports:
|
||||
- '7000:80'
|
||||
restart: always
|
||||
environment:
|
||||
PMA_HOST: database
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
||||
# NGINX
|
||||
webone:
|
||||
container_name: TTP-Nginx
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/Dockerfile
|
||||
target: nginx
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
ports:
|
||||
- "8080:80"
|
||||
links:
|
||||
- php
|
||||
depends_on:
|
||||
- php
|
||||
|
||||
# apache
|
||||
webtwo:
|
||||
container_name: TTP-Apache
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/Dockerfile
|
||||
target: apache
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
- ./docker/apache.conf:/etc/apache2/sites-available/000-default.conf
|
||||
ports:
|
||||
- "8000:80"
|
||||
environment:
|
||||
- APP_ENV=${APP_ENV}
|
||||
depends_on:
|
||||
- php
|
||||
|
||||
# php
|
||||
php:
|
||||
container_name: TTP-Php
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/Dockerfile
|
||||
target: php-fpm
|
||||
working_dir: /var/www/html
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
ports:
|
||||
- "9000:9000"
|
||||
environment:
|
||||
- APP_ENV=${APP_ENV}
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
66
docker/nginx.conf
Normal file
66
docker/nginx.conf
Normal file
@ -0,0 +1,66 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
index index.php;
|
||||
server_name TheTempusProject;
|
||||
error_log /var/www/html/logs/nginx-error.log;
|
||||
access_log /var/www/html/logs/nginx-access.log;
|
||||
root /var/www/html;
|
||||
charset utf-8;
|
||||
sendfile off;
|
||||
client_max_body_size 100m;
|
||||
|
||||
location /images/ {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/images/(.*)$ /index.php?error=image404&url=$1 last;
|
||||
}
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location /uploads/ {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/uploads/(.*)$ /index.php?error=upload404&url=$1 last;
|
||||
}
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location ~* \.(?:js|css|png|jpg|gif|ico)$ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
rewrite ^(.+)$ /images/favicon.ico break;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
rewrite ^(.+)$ /bin/robots.txt break;
|
||||
}
|
||||
|
||||
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;
|
||||
fastcgi_intercept_errors off;
|
||||
fastcgi_buffer_size 16k;
|
||||
fastcgi_buffers 4 16k;
|
||||
fastcgi_connect_timeout 60s;
|
||||
fastcgi_read_timeout 60s;
|
||||
fastcgi_send_timeout 60s;
|
||||
}
|
||||
|
||||
location / {
|
||||
rewrite ^/errors/(.*)$ /index.php?error=$1 last;
|
||||
rewrite ^(.+)$ /index.php?url=$1 last;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user