Created
February 27, 2021 03:57
-
-
Save fahmiegerton/27f70118749ef044935ff4bb4a8334e7 to your computer and use it in GitHub Desktop.
docker php-fpm alpine for codeigniter 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------------------------------------------------- | |
# CI4 server configuration | |
#-------------------------------------------------------- | |
server { | |
#listen 443 ssl; | |
listen 81; | |
index index.php index.html; | |
root /var/www/html/server/public; | |
charset utf-8; | |
client_max_body_size 20m; | |
# SSL for 443 | |
#ssl_certificate /etc/nginx/ssl/ssl-cert-snakeoil.pem; | |
#ssl_certificate_key /etc/nginx/ssl/ssl-cert-snakeoil.key; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location = /robots.txt { access_log off; log_not_found off; } | |
error_page 404 /index.php; | |
# Handle all php files (which will always be just /index.php) | |
# via factcgi PHP-FPM unix socket | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass php:9000; | |
fastcgi_index index.php; | |
# For comfortable debugging | |
fastcgi_read_timeout 1000; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.9' | |
services: | |
nginx: | |
build: | |
context: docker/nginx | |
dockerfile: Dockerfile | |
container_name: 'nginx' | |
depends_on: | |
- php | |
- mariadb | |
- nuxt | |
links: | |
- php | |
- nuxt | |
restart: unless-stopped | |
volumes: | |
- ./:/var/www/html | |
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf | |
- ./docker/nginx/logs:/var/log/nginx | |
- ./docker/nginx/vhost.conf:/etc/nginx/conf.d/site.conf | |
ports: | |
# CI4 port | |
- 8081:81 | |
mariadb: | |
image: mariadb:latest | |
container_name: mariadb | |
ports: | |
- 3306:3306 | |
volumes: | |
- ./docker/mariadb/data/:/var/lib/mysql | |
- ./docker/mariadb/logs:/var/log/mysql | |
restart: unless-stopped | |
environment: | |
MYSQL_ROOT_PASSWORD: pw | |
MYSQL_DATABASE: db | |
MYSQL_USER: db | |
MYSQL_PASSWORD: pw | |
php: | |
build: | |
context: docker/php | |
dockerfile: Dockerfile | |
args: | |
uid: 1000 | |
container_name: php | |
restart: always | |
volumes: | |
- ./server:/var/www/html/server | |
working_dir: /var/www/html/server | |
environment: | |
# If you down want to use xDebug, set remote_enable=0 | |
XDEBUG_CONFIG: "remote_enable=0" | |
PHP_IDE_CONFIG: "serverName=Docker" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Image | |
FROM php:7.4.15-fpm-alpine3.12 | |
# Set timezone | |
ENV TIMEZONE=Asia/Makassar | |
RUN ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime && echo $TIMEZONE > /etc/timezone | |
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ | |
RUN chmod +x /usr/local/bin/install-php-extensions && sync && install-php-extensions \ | |
gd \ | |
xdebug \ | |
@composer \ | |
intl \ | |
mcrypt \ | |
memcache \ | |
mysqli \ | |
xlswriter \ | |
uuid \ | |
zip | |
# Custom php.ini config | |
COPY php.ini /usr/local/etc/php/php.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Set up max script execution time for comfortable debugging | |
max_execution_time = 1000 | |
max_input_time = 1000 | |
; Maximum allowed size for uploaded files. | |
; http://php.net/upload-max-filesize | |
upload_max_filesize = 20M | |
; Maximum size of POST data that PHP will accept. | |
; Its value may be 0 to disable the limit. It is ignored if POST data reading | |
; is disabled through enable_post_data_reading. | |
; http://php.net/post-max-size | |
post_max_size = 20M | |
zlib.output_compression=Off | |
[Date] | |
; Defines the default timezone used by the date functions | |
; http://php.net/date.timezone | |
date.timezone ="Asia/Makassar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment