Skip to content

Commit

Permalink
create
Browse files Browse the repository at this point in the history
  • Loading branch information
tinpotnick committed Sep 25, 2022
0 parents commit 20908c1
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM php:7.4.30-fpm-alpine3.15 as builder

# prepare to install dependencies, install and include extensions
# NB adds also -common, -fpm and -snmp plus equivalents for PHP 8
RUN apk upgrade --update ; \
apk add --no-cache libpng-dev zlib-dev tzdata; \
docker-php-ext-install -j$(nproc) gd opcache; \
docker-php-source delete;

CMD [ "/usr/local/sbin/php-fpm", "-c", "/etc/php/php.ini", "-y", "/etc/php/php-fpm.conf" ]
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# PHP Docker image

Simple build for docker with additional modules from source. Examples for compose etc on usage.

# Version

Build versions are tracked using semver. Major.minor.bug.

## Major

If major changes backward compatible is not garanteed.

## Minor

New feature (for example additional PHP module). Every effort to maintain backwards compatability will be made.

## Bug

No new feture - bug fix update.

# Build

This will build x86 and arm. The version number is <phpversion>-<thisbuildversion>

```
docker buildx prune
docker buildx build --platform linux/amd64,linux/arm64 -t tinpotnick/php:7.4.30-0.0.1 . --push
```
18 changes: 18 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.9"
services:

nginx:
image: nginx
ports:
- 8080:80
volumes:
- ./config/nginx-site.conf:/etc/nginx/conf.d/default.conf
- ./www:/usr/share/nginx/html:rw

php:
image: tinpotnick/php:7.4.30-0.0.1
volumes:
- ./config/php.ini:/etc/php/php.ini
- ./config/php-fpm.conf:/etc/php/php-fpm.conf
- ./www:/usr/share/nginx/html:rw

35 changes: 35 additions & 0 deletions config/nginx-site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

server {
listen 80;
listen [::]:80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root /usr/share/nginx/html;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php:9000;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
36 changes: 36 additions & 0 deletions config/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

; ref
; https://www.php.net/manual/en/install.fpm.configuration.php

; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml


[global]

daemonize = no
events.mechanism = epoll

error_log = /var/log/php-fpm.log
log_level = debug

[www]

listen = 0.0.0.0:9000
user = www-data
group = www-data

;chroot = /data/web/
;chdir = /
pm = static
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache

201 changes: 201 additions & 0 deletions config/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
[PHP]


engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 10M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60

[CLI Server]

cli_server.color = On

[Date]


[filter]


[iconv]


[intl]


[sqlite3]

[Pcre]

pcre.jit=0

[Pdo]


[Pdo_mysql]

pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=

[Phar]


[mail function]

sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On

[ODBC]

odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1


[Interbase]

ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"

[MySQLi]


mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

[mysqlnd]

mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off


[PostgreSQL]

pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[bcmath]

bcmath.scale = 0

[browscap]


[Session]

session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5

[Assertion]

zend.assertions = -1

[mbstring]


[gd]


[exif]


[Tidy]

tidy.clean_output = Off

[soap]

soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5

[sysvshm]


[ldap]

ldap.max_links = -1

[dba]


[curl]


[openssl]
4 changes: 4 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


Hello World

3 changes: 3 additions & 0 deletions www/phpinfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

phpinfo();
3 changes: 3 additions & 0 deletions www/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

echo "Working!";

0 comments on commit 20908c1

Please sign in to comment.