Skip to content

Commit 7c4c849

Browse files
committed
Add docker-compose.yml with PHP 8.2 for development
1 parent ac8bfdb commit 7c4c849

File tree

5 files changed

+174
-2
lines changed

5 files changed

+174
-2
lines changed

.docker/Dockerfile-php82

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM php:8.2-fpm
2+
3+
RUN apt-get update
4+
RUN apt-get --yes --no-install-recommends install \
5+
apt-utils
6+
RUN apt-get --yes --no-install-recommends install \
7+
git \
8+
vim \
9+
curl \
10+
build-essential \
11+
locales \
12+
zip unzip \
13+
libfreetype6-dev \
14+
libjpeg62-turbo-dev \
15+
libmagickwand-dev \
16+
libpng-dev \
17+
libzip-dev
18+
RUN docker-php-ext-configure gd \
19+
--with-freetype \
20+
--with-jpeg
21+
RUN docker-php-ext-install -j$(nproc) \
22+
pdo \
23+
pdo_mysql \
24+
mysqli \
25+
zip \
26+
exif \
27+
intl \
28+
sockets \
29+
gd \
30+
bcmath \
31+
opcache
32+
33+
COPY build/php/opcache.ini /usr/local/etc/php/conf.d/
34+
COPY build/php/custom.ini /usr/local/etc/php/conf.d/
35+
36+
RUN pecl install xdebug-3.2.1 && docker-php-ext-enable xdebug
37+
38+
RUN php --version
39+
40+
# Install Composer
41+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
42+
# COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
43+
44+
RUN composer --version
45+
46+
RUN usermod -u 1000 www-data
47+
RUN usermod -a -G www-data root
48+
RUN mkdir -p /var/www
49+
RUN chown -R www-data:www-data /var/www
50+
RUN mkdir -p /var/www/.composer
51+
RUN chown -R www-data:www-data /var/www/.composer
52+
53+
WORKDIR /var/www/project/

.docker/build/php/custom.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
date.timezone = "Europe/Berlin"
2+
memory_limit = 4096M
3+
upload_max_filesize = 200M
4+
post_max_size = 200M
5+
6+
xdebug.mode = "develop,coverage"

.docker/build/php/opcache.ini

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
opcache.enable=1
2+
3+
; Determines if Zend OPCache is enabled for the CLI version of PHP
4+
opcache.enable_cli=0
5+
6+
; The OPcache shared memory storage size.
7+
opcache.memory_consumption=256
8+
9+
; The amount of memory for interned strings in Mbytes.
10+
;opcache.interned_strings_buffer=4
11+
12+
; The maximum number of keys (scripts) in the OPcache hash table.
13+
; Only numbers between 200 and 100000 are allowed.
14+
opcache.max_accelerated_files=100000
15+
16+
; The maximum percentage of "wasted" memory until a restart is scheduled.
17+
;opcache.max_wasted_percentage=5
18+
19+
; When this directive is enabled, the OPcache appends the current working
20+
; directory to the script key, thus eliminating possible collisions between
21+
; files with the same name (basename). Disabling the directive improves
22+
; performance, but may break existing applications.
23+
;opcache.use_cwd=1
24+
25+
; When disabled, you must reset the OPcache manually or restart the
26+
; webserver for changes to the filesystem to take effect.
27+
;opcache.validate_timestamps=1
28+
29+
; How often (in seconds) to check file timestamps for changes to the shared
30+
; memory storage allocation. ("1" means validate once per second, but only
31+
; once per request. "0" means always validate)
32+
;opcache.revalidate_freq=2
33+
34+
; Enables or disables file search in include_path optimization
35+
;opcache.revalidate_path=0
36+
37+
; If disabled, all PHPDoc comments are dropped from the code to reduce the
38+
; size of the optimized code.
39+
;opcache.save_comments=1
40+
41+
; If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments"
42+
; may be always stored (save_comments=1), but not loaded by applications
43+
; that don't need them anyway.
44+
;opcache.load_comments=1
45+
46+
; If enabled, a fast shutdown sequence is used for the accelerated code
47+
;opcache.fast_shutdown=0
48+
49+
; Allow file existence override (file_exists, etc.) performance feature.
50+
;opcache.enable_file_override=0
51+
52+
; A bitmask, where each bit enables or disables the appropriate OPcache
53+
; passes
54+
;opcache.optimization_level=0xffffffff
55+
56+
;opcache.inherited_hack=1
57+
;opcache.dups_fix=0
58+
59+
; The location of the OPcache blacklist file (wildcards allowed).
60+
; Each OPcache blacklist file is a text file that holds the names of files
61+
; that should not be accelerated. The file format is to add each filename
62+
; to a new line. The filename may be a full path or just a file prefix
63+
; (i.e., /var/www/x blacklists all the files and directories in /var/www
64+
; that start with 'x'). Line starting with a ; are ignored (comments).
65+
;opcache.blacklist_filename=
66+
67+
; Allows exclusion of large files from being cached. By default all files
68+
; are cached.
69+
;opcache.max_file_size=0
70+
71+
; Check the cache checksum each N requests.
72+
; The default value of "0" means that the checks are disabled.
73+
;opcache.consistency_checks=0
74+
75+
; How long to wait (in seconds) for a scheduled restart to begin if the cache
76+
; is not being accessed.
77+
;opcache.force_restart_timeout=180
78+
79+
; OPcache error_log file name. Empty string assumes "stderr".
80+
;opcache.error_log=
81+
82+
; All OPcache errors go to the Web server log.
83+
; By default, only fatal errors (level 0) or errors (level 1) are logged.
84+
; You can also enable warnings (level 2), info messages (level 3) or
85+
; debug messages (level 4).
86+
;opcache.log_verbosity_level=1
87+
88+
; Preferred Shared Memory back-end. Leave empty and let the system decide.
89+
;opcache.preferred_memory_model=
90+
91+
; Protect the shared memory from unexpected writing during script execution.
92+
; Useful for internal debugging only.
93+
;opcache.protect_memory=0

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/docs export-ignore
2-
/tests export-ignore
1+
/.docker export-ignore
32
/.gitattributes export-ignore
43
/.gitignore export-ignore
54
/.travis.yml export-ignore
5+
/docs export-ignore
66
/phpunit.xml export-ignore
7+
/tests export-ignore

docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: "3.7"
2+
3+
services:
4+
php:
5+
# Info to build the Docker image
6+
build:
7+
# Specify where the Dockerfile is located (e.g. in the root directory of the project)
8+
context: .docker
9+
# Specify the name of the Dockerfile for changing the PHP version
10+
dockerfile: Dockerfile-php82
11+
# Modifiy Ports for every project: <outside>:<inside>
12+
ports:
13+
- 8200:80
14+
# environment: # You can use this section to set environment variables. But you can also use the .env file.
15+
# - DATABASE_URL=mysql://root:root@db/database_name
16+
volumes:
17+
# Location of the project for php-fpm. Note this should be the same for NGINX.*
18+
- ./:/var/www/project/
19+

0 commit comments

Comments
 (0)