Setup Docker compose for project: Codeigniter >= 3 or Laravel >= 8
Using image PHP-NGINX asapdotid/php-nginx:8.2 as compose image.
- Docker image: asapdotid/php-nginx
- Combine with Traefik custom setup: asapdotid/traefik
# @see https://docs.docker.com/compose/reference/envvars/
COMPOSE_CONVERT_WINDOWS_PATHS=1
# Docker Registry
DOCKER_REGISTRY=docker.io
# Docker namespace
DOCKER_NAMESPACE=asapdotid
# Docker image
DOCKER_IMAGE=php-nginx
# Docker image tag 7.4, 8.1, 8.2/latest
DOCKER_IMAGE_TAG=8.2
# will use on (docker composer --project/-p)
DOCKER_PROJECT_NAME=dev
# Set type of compose: codeigniter | laravel
DOCKER_PROJECT_FRAMEWORK=codeigniter
# Project directory
DOCKER_PROJECT_DIR=/home/application
# Setup proxy with traefik entrypoint
DOCKER_PROXY_ENTRYPOINTS=websecure
DOCKER_PROXY_URL=app.jogjascript.comCan add/update envs base on docker image envs
# Docker compose envvars
APPLICATION_FRAMEWORK=codeigniter
APPLICATION_ENV=production
APPLICATION_UID=1000
APPLICATION_GID=1000
PHP_MEMORY_LIMIT=150M
PHP_POST_MAX_SIZE=150M
PHP_UPLOAD_MAX_FILESIZE=600
PHP_MEMORY_LIMIT=150M
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE=150M
# Pointing to index.php
WEB_DOCUMENT_ROOT=/app/public
WEB_ALIAS_DOMAIN=app.jogjascript.com
SKIP_COMPOSER=false
TIMEZONE=Asia/Jakartadocker network create proxy
docker network create securemake helpInitial makefile commands
make initInitial docker compose commands
make env| Environment variable | Description | Default |
|---|---|---|
LOG_STDOUT |
Destination of daemon output | empty (stdout) |
LOG_STDERR |
Destination of daemon errors | empty (stdout) |
SERVICE_CRON_OPTS |
cron daemon arguments | empty (when syslog is used) |
SERVICE_DNSMASQ_OPTS |
dnsmasq daemon arguments | empty (when syslog is used) |
SERVICE_DNSMASQ_USER |
dnsmasq effective user | root |
SERVICE_POSTFIX_OPTS |
postfix daemon arguments | empty (when syslog is used) |
SERVICE_SSH_OPTS |
ssh daemon arguments | empty (when syslog is used) |
SERVICE_SUPERVISOR_OPTS |
supervisor daemon arguments | empty (when syslog is used) |
SERVICE_SUPERVISOR_USER |
supervisor effective user | root |
SERVICE_SYSLOG_OPTS |
syslog daemon arguments | empty (when syslog is used) |
| Variable | Description | Default |
|---|---|---|
CLI_SCRIPT |
Predefined CLI script for service | - |
APPLICATION_UID |
PHP-FPM UID (Effective user ID) | 1000 |
APPLICATION_GID |
PHP-FPM GID (Effective group ID) | 1000 |
WEB_DOCUMENT_ROOT |
Document root for Nginx | /app |
WEB_DOCUMENT_INDEX |
Document index (eg. index.php) for Nginx |
index.php |
WEB_ALIAS_DOMAIN |
Alias domains (eg. *.vm) for Nginx |
*.vm |
WEB_PHP_SOCKET |
PHP-FPM socket address | 127.0.0.1:9000 (for php-* images) |
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE |
Nginx client_max_body_size |
50m (when nginx is used) |
TIMEZONE |
Set OS and PHP timezone |
Asia/Jakarta |
APPLICATION_ENV |
Set for composer install on development or production |
production |
APPLICATION_FRAMEWORK |
Framework codeigniter or laravel |
codeigniter |
SKIP_COMPOSER |
Skip action composer install = true or false |
false |
You can specify eg. php.memory_limit=256M as dynamic env variable which will set memory_limit = 256M as php setting.
| Environment variable | Description | Default |
|---|---|---|
php.{setting-key} |
Sets the {setting-key} as php setting |
- |
PHP_DATE_TIMEZONE |
date.timezone |
UTC |
PHP_DISPLAY_ERRORS |
display_errors |
0 |
PHP_MEMORY_LIMIT |
memory_limit |
512M |
PHP_MAX_EXECUTION_TIME |
max_execution_time |
300 |
PHP_POST_MAX_SIZE |
post_max_size |
50M |
PHP_UPLOAD_MAX_FILESIZE |
upload_max_filesize |
50M |
PHP_OPCACHE_MEMORY_CONSUMPTION |
opcache.memory_consumption |
256 |
PHP_OPCACHE_MAX_ACCELERATED_FILES |
opcache.max_accelerated_files |
7963 |
PHP_OPCACHE_VALIDATE_TIMESTAMPS |
opcache.validate_timestamps |
default |
PHP_OPCACHE_REVALIDATE_FREQ |
opcache.revalidate_freq |
default |
PHP_OPCACHE_INTERNED_STRINGS_BUFFER |
opcache.interned_strings_buffer |
16 |
You can specify eg. fpm.pool.pm.max_requests=1000 as dyanmic env variable which will sets pm.max_requests = 1000 as fpm pool setting.
The prefix fpm.pool is for pool settings and fpm.global for global master process settings.
| Environment variable | Description |
|---|---|
fpm.global.{setting-key} |
Sets the {setting-key} as fpm global setting for the master |
fpm.pool.{setting-key} |
Sets the {setting-key} as fpm pool setting |
FPM_PROCESS_MAX |
process.max |
FPM_PM_MAX_CHILDREN |
pm.max_children |
FPM_PM_START_SERVERS |
pm.start_servers |
FPM_PM_MIN_SPARE_SERVERS |
pm.min_spare_servers |
FPM_PM_MAX_SPARE_SERVERS |
pm.max_spare_servers |
FPM_PROCESS_IDLE_TIMEOUT |
pm.process_idle_timeout |
FPM_MAX_REQUESTS |
pm.max_requests |
FPM_REQUEST_TERMINATE_TIMEOUT |
request_terminate_timeout |
FPM_RLIMIT_FILES |
rlimit_files |
FPM_RLIMIT_CORE |
rlimit_core |
Due to the incompatibilities between composer v1 and v2 we introduce a simple mechanism to switch between composer versions.
| Environment variable | Description | Default |
|---|---|---|
COMPOSER_VERSION |
Specify the composer version to use | 2 |
MIT / BSD
This Code was created at 2025 by Asapdotid. 🚀