1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00

images and linking

This commit is contained in:
Robin Appelman 2021-03-12 21:49:58 +01:00
commit 06c0330de8
16 changed files with 1045 additions and 50 deletions

1
images/haze Submodule

@ -0,0 +1 @@
Subproject commit 2f75a115ed8964225cb158ce43474ee270bf1b27

92
images/php/Dockerfile Normal file
View file

@ -0,0 +1,92 @@
FROM php:7.3-fpm
MAINTAINER Robin Appelman <robin@icewind.nl>
RUN DEBIAN_FRONTEND=noninteractive ;\
apt-get update && \
apt-get install --assume-yes \
bzip2 \
nginx \
libaio-dev \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/*
# php exceptions
RUN apt-get update \
&& apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libpq5 \
libpq-dev \
libsqlite3-dev \
libcurl4-openssl-dev \
libicu-dev \
libzip-dev \
libmagickwand-dev \
libmagickcore-dev \
libonig-dev \
libldap2-dev \
libsmbclient-dev \
&& docker-php-ext-configure gd \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
&& docker-php-ext-install iconv zip pdo pdo_pgsql pdo_sqlite pgsql pdo_mysql intl curl mbstring gd pcntl ldap \
&& pecl install imagick \
&& pecl install inotify \
&& pecl install smbclient \
&& apt-get remove -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libpq-dev \
libsqlite3-dev \
libcurl4-openssl-dev \
libicu-dev \
libzip-dev \
libmagick-dev \
libmagickwand-dev \
libmagickcore-dev \
libonig-dev \
libldap2-dev \
libsmbclient-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pecl install apcu \
&& pecl install xdebug \
&& pecl install redis \
&& export VERSION=`php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;"` \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/${VERSION} \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
&& mv /tmp/blackfire-*.so `php -r "echo ini_get('extension_dir');"`/blackfire.so \
&& echo "extension=imagick.so" > $PHP_INI_DIR/conf.d/imagick.ini \
&& echo "extension=smbclient.so" > $PHP_INI_DIR/conf.d/smbclient.ini \
&& echo "extension=inotify.so" > $PHP_INI_DIR/conf.d/inotify.ini \
&& echo "extension=blackfire.so\nblackfire.agent_socket=\${BLACKFIRE_PORT}" > $PHP_INI_DIR/conf.d/blackfire.ini \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > $PHP_INI_DIR/conf.d/xdebug.ini \
&& echo "xdebug.mode=debug,trace,profile" >> $PHP_INI_DIR/conf.d/xdebug.ini \
&& echo "xdebug.start_with_request=trigger" >> $PHP_INI_DIR/conf.d/xdebug.ini \
&& echo "xdebug.remote_port=9000" >> $PHP_INI_DIR/conf.d/xdebug.ini \
&& echo "xdebug.discover_client_host=true" >> $PHP_INI_DIR/conf.d/xdebug.ini \
&& echo "memory_limit = 512M" > $PHP_INI_DIR/conf.d/memory_limit.ini
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
ADD apcu.ini opcache.ini redis.ini $PHP_INI_DIR/conf.d/
ADD nginx.conf nginx-app.conf /etc/nginx/
ADD php-fpm.conf /usr/local/etc/
ADD index.php /var/www/html/
ADD bootstrap-nginx.sh /usr/local/bin/
EXPOSE 80
ENTRYPOINT ["bootstrap-nginx.sh"]

2
images/php/apcu.ini Normal file
View file

@ -0,0 +1,2 @@
extension=apcu.so
apc.enable_cli = 1

17
images/php/bootstrap-nginx.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
touch /var/log/nginx/access.log
touch /var/log/nginx/error.log
tail --follow --retry /var/log/nginx/*.log &
UID=${UID:-$(id -u)}
GID=${GID:-$(id -g)}
groupadd -g $GID haze
useradd -u $UID -g $GID haze
cat /usr/local/etc/php-fpm.conf
/usr/local/sbin/php-fpm &
/etc/init.d/nginx start

3
images/php/index.php Normal file
View file

@ -0,0 +1,3 @@
<?php
echo "hello_world";

View file

@ -0,0 +1 @@

86
images/php/nginx.conf Normal file
View file

@ -0,0 +1,86 @@
user haze;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# Don't send the nginx version number in error pages and Server header
server_tokens off;
upstream php-handler {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
# Path to the root of your installation
root /var/www/html;
client_max_body_size 10G;
# set max upload size
fastcgi_buffers 64 4K;
index index.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
include nginx-app.conf;
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php-handler;
}
## Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
## Optional: Don't log access to assets
access_log off;
}
}
}

2
images/php/opcache.ini Normal file
View file

@ -0,0 +1,2 @@
zend_extension=opcache.so
opcache.enable_cli=1

32
images/php/php-fpm.conf Normal file
View file

@ -0,0 +1,32 @@
; This file was initially adapated from the output of: (on PHP 5.6)
; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
[global]
error_log = /proc/self/fd/2
daemonize = no
[www]
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2
user = haze
group = haze
listen = /var/run/php5-fpm.sock
listen.owner = haze
listen.group = haze
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
clear_env = no
; Ensure worker stdout and stderr are sent to the main error log.
catch_workers_output = yes

1
images/php/redis.ini Normal file
View file

@ -0,0 +1 @@
extension=redis.so