Skip to content

Commit bd65a2b

Browse files
author
aengels
committed
New dockerfile to use php 8.1
1 parent 08ff666 commit bd65a2b

File tree

5 files changed

+118
-3
lines changed

5 files changed

+118
-3
lines changed

.docker/nginx/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ http {
3838
location ~ \.php$ {
3939
include fastcgi_params;
4040

41-
fastcgi_pass unix:/var/run/php8-fpm.sock;
41+
fastcgi_pass 127.0.0.1:9000;
4242
fastcgi_split_path_info ^(.+\.php)(/.*)$;
4343

4444
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

.docker/php/php-fpm.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[global]
2+
daemonize = no
3+
4+
error_log = /var/log/php-fpm/error.log
5+
log_level = error
6+
7+
[www]
8+
user = www-data
9+
group = www-data
10+
11+
clear_env = no
12+
13+
catch_workers_output = yes
14+
15+
slowlog = /var/log/php-fpm/slow.log
16+
17+
listen = 127.0.0.1:9000
18+
listen.owner = www-data
19+
listen.group = www-data
20+
listen.mode = 0660
21+
22+
pm = dynamic
23+
pm.max_children = 5
24+
pm.start_servers = 2
25+
pm.min_spare_servers = 1
26+
pm.max_spare_servers = 3
27+
pm.status_path = /status
28+
29+
security.limit_extensions = .php

.docker/php/supervisord.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[supervisord]
2+
nodaemon = true
3+
user = root
4+
pidfile = /run/supervisord.pid
5+
6+
[program:nginx]
7+
command = /usr/sbin/nginx
8+
user = root
9+
autostart = true
10+
11+
[program:php-fpm]
12+
command = /usr/sbin/php-fpm
13+
user = root
14+
autostart = true

Dockerfile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
FROM node:14-alpine AS node
2+
FROM composer:2.3 AS composer
3+
4+
FROM alpine:3.16.9
5+
6+
COPY --from=composer /usr/bin/composer /usr/bin/composer
7+
8+
COPY --from=node /usr/lib /usr/lib
9+
COPY --from=node /usr/local/share /usr/local/share
10+
COPY --from=node /usr/local/lib /usr/local/lib
11+
COPY --from=node /usr/local/include /usr/local/include
12+
COPY --from=node /usr/local/bin /usr/local/bin
13+
14+
RUN apk update --no-cache && apk add --no-cache \
15+
curl \
16+
supervisor \
17+
unzip \
18+
python3 \
19+
g++ \
20+
make \
21+
nginx \
22+
yarn \
23+
php81 \
24+
php81-apcu \
25+
php81-calendar \
26+
php81-common \
27+
php81-cli \
28+
php81-common \
29+
php81-ctype \
30+
php81-curl \
31+
php81-dom \
32+
php81-exif \
33+
php81-fileinfo \
34+
php81-fpm \
35+
php81-gd \
36+
php81-intl \
37+
php81-mbstring \
38+
php81-mysqli \
39+
php81-mysqlnd \
40+
php81-opcache \
41+
php81-pdo \
42+
php81-pdo_mysql \
43+
php81-pdo_pgsql \
44+
php81-pgsql \
45+
php81-phar \
46+
php81-session \
47+
php81-simplexml \
48+
php81-sqlite3 \
49+
php81-tokenizer \
50+
php81-xml \
51+
php81-xmlwriter \
52+
php81-xsl \
53+
php81-zip
54+
55+
RUN rm -rf /var/lib/apk/lists/* /tmp/* /var/tmp/* /usr/share/doc/* /usr/share/man/* /var/cache/apk/*
56+
57+
RUN ln -s /usr/sbin/php-fpm81 /usr/sbin/php-fpm \
58+
&& ln -s /usr/bin/php81 /usr/bin/php \
59+
&& mkdir -p /run/php /var/log/php-fpm
60+
61+
RUN adduser -u 1000 -D -S -G www-data www-data
62+
63+
COPY .docker/php/supervisord.conf /etc/supervisor/conf.d/supervisor.conf
64+
COPY .docker/nginx/nginx.conf /etc/nginx/nginx.conf
65+
COPY .docker/php/php-fpm.conf /etc/php81/php-fpm.conf
66+
COPY .docker/php/php.ini /etc/php81/php.ini
67+
68+
WORKDIR /app
69+
70+
EXPOSE 80
71+
72+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
app:
3-
image: sylius/standard:1.11-traditional-alpine
3+
build: .docker/php
44
environment:
55
APP_ENV: "dev"
66
DATABASE_URL: "mysql://root:mysql@mysql/sylius_%kernel.environment%?charset=utf8mb4"
@@ -9,7 +9,7 @@ services:
99
volumes:
1010
- ./:/app:delegated
1111
- ./.docker/php/php.ini:/etc/php8/php.ini:delegated
12-
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf:delegated
12+
- ./.docker/php/nginx.conf:/etc/nginx/nginx.conf:delegated
1313
ports:
1414
- 80:80
1515
depends_on:

0 commit comments

Comments
 (0)