Skip to content

Commit e1c346c

Browse files
committed
initial commit
0 parents  commit e1c346c

File tree

12 files changed

+215
-0
lines changed

12 files changed

+215
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ARG VERSION=7.4-fpm
2+
ARG FLAVOUR=""
3+
4+
FROM node:lts${FLAVOUR} AS node_lts
5+
FROM nginx:stable${FLAVOUR} AS nginx_stable
6+
FROM thisisdevelopment/docker-user-init:latest${FLAVOUR} AS docker-user-init
7+
FROM scratch AS overlay
8+
9+
COPY --from=docker-user-init /docker-user-init /usr/bin/
10+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
11+
COPY --from=composer /usr/bin/composer /usr/bin/composer
12+
COPY --from=node_lts /usr/local /usr/local
13+
COPY --from=node_lts /opt/yarn* /opt/
14+
COPY --from=nginx_stable /usr/sbin/nginx* /usr/sbin/
15+
COPY --from=nginx_stable /usr/lib/nginx /usr/lib/nginx
16+
COPY --from=nginx_stable /etc/nginx /etc/nginx
17+
COPY files /
18+
19+
FROM php:${VERSION}${FLAVOUR}
20+
WORKDIR /var/www
21+
22+
ENV \
23+
PHP_EXTENSIONS="bcmath calendar exif gettext imagick intl mysqli opcache pcntl pdo_mysql redis soap sockets xdebug zip" \
24+
EXTRA_PACKAGES="unzip mysql-client nano joe vim" \
25+
DOCKER_USER="www-data:www-data"
26+
27+
COPY --from=overlay / /
28+
29+
RUN set -eux; \
30+
chmod u+s,g+s /usr/bin/docker-user-init; \
31+
install-php-extensions ${PHP_EXTENSIONS}; \
32+
pkg-install pcre shadow dumb-init bash ${EXTRA_PACKAGES}; \
33+
pkg-purge ${PHPIZE_DEPS}; \
34+
pkg-cleanup; \
35+
composer global require hirak/prestissimo; \
36+
cp -a /usr/local/etc/php/* /etc/php/; \
37+
rm -f /etc/php/conf.d/docker-php-ext-xdebug.ini; \
38+
mv /etc/php/php.ini-production /etc/php/php.ini; \
39+
rm -rf /var/www/*; \
40+
mkdir /home/www; \
41+
chown -R -h ${DOCKER_USER} /home/www /var/www;
42+
43+
USER ${DOCKER_USER}
44+
ENTRYPOINT ["/usr/bin/docker-user-init", "--"]
45+
CMD ["php-fpm"]

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This is development - php
2+
3+
Base php docker image
4+
5+
This image contains:
6+
- docker-user-init (https://github.com/thisisdevelopment/docker-user-init)
7+
- nginx:stable
8+
- composer:latest
9+
- node:lts (for webpack builds etc)
10+
- php-fpm:7.X with the following extensions enabled
11+
- bcmath
12+
- calendar
13+
- exif
14+
- gettext
15+
- imagick
16+
- intl
17+
- mysqli
18+
- opcache
19+
- pcntl
20+
- pdo_mysql
21+
- redis
22+
- soap
23+
- sockets
24+
- zip
25+
- xdebug (available, but not enabled)
26+

files/etc/group

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
root:x:0:root
2+
www-data:x:33:www-data
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
server {
2+
listen 80 default_server;
3+
index index.php index.html;
4+
root /var/www/public;
5+
6+
location / {
7+
try_files $uri /index.php?$args;
8+
}
9+
10+
location ~ [^/]\.php(/|$) {
11+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
12+
fastcgi_pass 127.0.0.1:9000;
13+
fastcgi_index index.php;
14+
include fastcgi_params;
15+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
16+
fastcgi_param PATH_INFO $fastcgi_path_info;
17+
}
18+
}

files/etc/nginx/nginx.conf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
user www-data;
2+
worker_processes auto;
3+
4+
events {
5+
worker_connections 1024;
6+
}
7+
8+
error_log /dev/stdout info;
9+
pid /tmp/nginx.pid;
10+
11+
http {
12+
client_body_temp_path /tmp/client_temp;
13+
proxy_temp_path /tmp/proxy_temp_path;
14+
fastcgi_temp_path /tmp/fastcgi_temp;
15+
uwsgi_temp_path /tmp/uwsgi_temp;
16+
scgi_temp_path /tmp/scgi_temp;
17+
18+
include /etc/nginx/mime.types;
19+
default_type application/octet-stream;
20+
21+
log_format main '[$time_local] "$http_x_forwarded_for" $request_time $host $status $body_bytes_sent "$request" "$http_referer" "$http_user_agent"';
22+
access_log /dev/stdout main;
23+
24+
keepalive_timeout 65;
25+
gzip on;
26+
gzip_http_version 1.0;
27+
gzip_disable "MSIE [1-6].";
28+
gzip_vary on;
29+
gzip_proxied any;
30+
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
31+
32+
client_max_body_size 16M;
33+
34+
add_header Strict-Transport-Security "max-age=31536000";
35+
add_header 'Access-Control-Allow-Origin' '*';
36+
37+
include /etc/nginx/conf.d/*.conf;
38+
}

files/etc/passwd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
root:x:0:0:root:/root:/bin/bash
2+
www-data:www-data:33:33:www-data:/home/www:/sbin/nologin

files/etc/php/conf.d/90-app.ini

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[php]
2+
display_errors = Off
3+
display_startup_errors = Off
4+
log_errors = On
5+
log_errors_max_len = 4096
6+
error_log = /proc/self/fd/2
7+
8+
error_reporting = -1
9+
10+
memory_limit = 128M
11+
12+
opcache.enable=On
13+
14+
always_populate_raw_post_data = -1
15+
16+
date.timezone = Europe/Amsterdam
17+
18+
expose_php = Off
19+
20+
upload_max_filesize = 100M
21+
post_max_size = 100M

files/etc/shadow

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root:!::0:::::

files/usr/bin/pkg-cleanup

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
source /etc/os-release
6+
if [ "$ID" = "debian" ] || [ "$ID" = "ubuntu" ]; then
7+
rm -rf /var/lib/apt/lists/*
8+
elif [ "$ID" = "alpine" ]; then
9+
apk del --no-cache --purge $@
10+
fi
11+

0 commit comments

Comments
 (0)