Skip to content

Instantly share code, notes, and snippets.

@vacri
Last active June 4, 2020 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vacri/dd9860275df16996a4fa2ef26cfd8003 to your computer and use it in GitHub Desktop.
Save vacri/dd9860275df16996a4fa2ef26cfd8003 to your computer and use it in GitHub Desktop.
(empty file to name the gist)
https://github.com/directus/directus/discussions/2726
FROM debian:buster-slim
ENV PHP_VERSION=7.3
ENV USER=www-data
ENV DEBIAN_FRONTEND=noninteractive
ENV COMPOSER_COMMIT_HASH=ba13e3fc70f1c66250d1ea7ea4911d593aa1dba5
ENV COMPOSER_CACHE_DIR=/tmp/composer
RUN apt-get update \
&& apt-get --no-install-recommends --no-install-suggests --yes --quiet install \
ca-certificates \
curl \
lsb-release \
nginx \
supervisor \
git \
unzip \
&& apt-get --no-install-recommends --no-install-suggests --yes --quiet install \
php${PHP_VERSION}-fpm \
php${PHP_VERSION}-curl \
php${PHP_VERSION}-gd \
php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-mysql \
php${PHP_VERSION}-redis \
php${PHP_VERSION}-soap \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc/* /usr/share/man/* /usr/share/info/* \
&& mkdir /run/php
RUN curl -s https://raw.githubusercontent.com/composer/getcomposer.org/${COMPOSER_COMMIT_HASH}/web/installer | php -- --quiet \
&& mv composer.phar /usr/local/bin/composer
COPY config/nginx.conf /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/00-default
COPY config/nginx-default-vhost.conf /etc/nginx/sites-enabled/zz-default
COPY config/fpm-pool.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
COPY config/php.ini /etc/php/${PHP_VERSION}/fpm/php.ini
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chown -R $USER /run \
&& chown -R $USER /var/lib/nginx \
&& chown -R $USER /var/log/nginx
RUN mkdir -p /var/www/html
USER $USER
WORKDIR /var/www/html
COPY config/web/ /var/www/html/
EXPOSE 8080
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping
FROM my-repo-domain.com/public-php7.3:latest
ENV COMPONENT=my-namespace
COPY --chown=www-data:www-data . /var/www/app/
COPY ./deploy/docker/nginx/nginx-container.conf /etc/nginx/sites-enabled/${COMPONENT}.conf
WORKDIR /var/www/app/
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/server/ping
[global]
error_log = /dev/stderr
[www]
listen = 127.0.0.1:9000
pm.status_path = /fpm-status
pm = ondemand
pm.max_children = 8
pm.process_idle_timeout = 10s;
pm.max_requests = 1000
clear_env = no
catch_workers_output = yes
decorate_workers_output = no
ping.path = /fpm-ping
; this is the stock Debian php.ini for Debian 10's version of php7.3-fpm at time of writing, with the following edits
; - comments stripped
; - empty sections stripped
; - zlib.output_compression = On # defaults to Off
; - post_max_size = 64M # defaults to 8M
; - upload_max_filesize = 32M # defaults to 2M
; - date.timezone="UTC" # default not explicitly set
; non-empty but 'probably unused' sections have been left in place if they have a setting (eg Interbase)
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = On
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
disable_classes =
zend.enable_gc = On
expose_php = Off
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 = 64M
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 = 32M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
date.timezone="UTC"
[Pdo_mysql]
pdo_mysql.default_socket=
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = Off
[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.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
[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.cookie_samesite =
session.serialize_handler = php
session.gc_probability = 0
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
[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
[ldap]
ldap.max_links = -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment