Skip to content

Commit

Permalink
Update docker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlgo11 committed Sep 19, 2021
1 parent 767f356 commit 598343b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM php:8.0-fpm-alpine3.14
RUN apk add --no-cache composer nginx php-mysqli
FROM php:8-fpm-alpine
RUN apk add --no-cache composer php-mysqli
RUN docker-php-ext-install mysqli
RUN docker-php-ext-enable mysqli
RUN rm -rf /var/www/*
COPY --chown=www-data:www-data ./ /var/www
COPY ./resources/nginx.conf /etc/nginx/nginx.conf
COPY ./resources/php.ini $PHP_INI_DIR/php.ini
RUN composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader -d /var/www
CMD php-fpm -D; nginx; tail -F /dev/null;
USER 1025
37 changes: 22 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
version: "3"
version: "3.3"
services:
web:

php:
build: .
container_name: web
environment:
MYSQL_HOST: db
MYSQL_PORT: 3306
MYSQL_USER: guest-portal
MYSQL_PASSWORD: guest-portal
MYSQL_DATABASE: guest-portal
MYSQL_PORT: 3306
UNIFI_USER: guest-portal
UNIFI_PASSWORD: password
UNIFI_URL: https://192.168.0.1
UNIFI_SITE: default
UNIFI_VERSION: 6.0.43
UNIFI_VERIFY_CERT: 0
ports:
- "8080:80"
volumes:
- ./:/app
- "./:/var/www:ro"

nginx:
image: nginx
restart: unless-stopped
user: nginx
volumes:
- "./resources/nginx.conf:/etc/nginx/nginx.conf:ro"
- "./:/var/www:ro"
read_only: true
tmpfs:
- /tmp
ports:
- "8080:8080"

db:
image: linuxserver/mariadb:alpine
container_name: db
volumes:
- mysql:/var/lib/mysql
- ./resources/db-template.sql:/docker-entrypoint-initdb.d/db.sql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_USER: guest-portal
MYSQL_PASSWORD: guest-portal
MYSQL_DATABASE: guest-portal
phpmyadmin:
container_name: phpmyadmin
image: phpmyadmin
ports:
- "81:80"

volumes:
mysql:
mysql:
32 changes: 26 additions & 6 deletions resources/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
user www-data;
worker_processes auto;
pid /tmp/nginx.pid;
pid /dev/null;
error_log /dev/stderr crit;

events {
worker_connections 1024;
Expand All @@ -19,9 +19,20 @@ http {
tcp_nopush on;
tcp_nodelay on;

##
# Temp paths
##

client_body_temp_path /tmp 1 2;
proxy_temp_path /tmp 1 2;
fastcgi_temp_path /tmp 1 2;
uwsgi_temp_path /tmp 1 2;
scgi_temp_path /tmp 1 2;

##
# Client Settings
##

client_body_buffer_size 1K;
client_header_buffer_size 1k;
client_max_body_size 1K;
Expand All @@ -30,17 +41,26 @@ http {
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
proxy_buffering off;

##
# Compression
##

gzip on;
gzip_vary on;
gzip_static on;

##
# Log Settings
##

access_log /dev/stdout;
error_log /dev/stdout crit;
access_log /dev/stdout;
error_log /dev/stderr crit;

server {
server_name _;
listen 80;
listen 8080;
index index.php;
root /var/www/public;

Expand All @@ -50,7 +70,7 @@ http {
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
Expand Down

0 comments on commit 598343b

Please sign in to comment.