Skip to content

Commit b3bf062

Browse files
authored
Merge pull request #41 from zerossB/develop
Merging Develop into Master
2 parents d3a55f0 + fab6d7f commit b3bf062

File tree

4 files changed

+62
-14
lines changed

4 files changed

+62
-14
lines changed

php/8.0-supervisor-debian/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@ FROM php:8.0-fpm
22

33
ENV TZ=UTC
44

5+
ENV PHP_OPCACHE_ENABLE=1
6+
ENV PHP_OPCACHE_REVALIDATE_FREQ=0
7+
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0
8+
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES=10000
9+
ENV PHP_OPCACHE_MEMORY_CONSUMPTION=192
10+
ENV PHP_OPCACHE_MAX_WASTED_PERCENTAGE=10
11+
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16
12+
513
# Install system dependencies
6-
RUN apt-get update && apt-get install -y --no-install-recommends build-essential software-properties-common ca-certificates wget tzdata git curl libpng-dev libonig-dev libxml2-dev zip unzip \
7-
libmariadb-dev sqlite3 libsqlite3-dev g++ libicu-dev libpq-dev libzip-dev zip zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libcurl4-openssl-dev \
8-
gnupg gnupg2 gnupg1 supervisor nginx cron
14+
RUN apt-get update && apt-get install -y --no-install-recommends build-essential software-properties-common ca-certificates \
15+
wget tzdata git curl libpng-dev libonig-dev libxml2-dev zip unzip libmariadb-dev sqlite3 libsqlite3-dev g++ \
16+
libicu-dev libpq-dev libzip-dev zip zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
17+
libcurl4-openssl-dev gnupg gnupg2 gnupg1 supervisor nginx cron
918

1019
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime; \
1120
echo $TZ > /etc/timezone;
@@ -31,6 +40,7 @@ COPY . /var/www/html
3140
RUN cp ./scripts/entrypoint.sh /usr/local/bin/entry-almobi; \
3241
cp ./scripts/nginx.conf /etc/nginx/sites-available/default; \
3342
cp ./scripts/supervisor.ini /etc/supervisor/supervisord.conf; \
43+
cp ./scripts/opcache.ini /usr/local/etc/php/conf.d/opcache.ini; \
3444
chmod +x /usr/local/bin/entry-almobi;
3545

3646
EXPOSE 8000

php/8.1-supervisor-debian/Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ FROM php:8.1-fpm
22

33
ENV TZ=UTC
44

5+
ENV PHP_OPCACHE_ENABLE=1
6+
ENV PHP_OPCACHE_REVALIDATE_FREQ=0
7+
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0
8+
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES=10000
9+
ENV PHP_OPCACHE_MEMORY_CONSUMPTION=192
10+
ENV PHP_OPCACHE_MAX_WASTED_PERCENTAGE=10
11+
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16
12+
513
# Install system dependencies
6-
RUN apt-get update && apt-get install -y --no-install-recommends build-essential software-properties-common ca-certificates wget tzdata git curl libpng-dev libonig-dev libxml2-dev zip unzip \
7-
libmariadb-dev sqlite3 libsqlite3-dev g++ libicu-dev libpq-dev libzip-dev zip zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libcurl4-openssl-dev \
14+
RUN apt-get update && apt-get install -y --no-install-recommends build-essential software-properties-common ca-certificates \
15+
wget tzdata git curl libpng-dev libonig-dev libxml2-dev zip unzip libmariadb-dev sqlite3 libsqlite3-dev g++ \
16+
libicu-dev libpq-dev libzip-dev zip zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev libcurl4-openssl-dev \
817
gnupg gnupg2 gnupg1 supervisor nginx cron
918

1019
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime; \
@@ -31,6 +40,7 @@ COPY . /var/www/html
3140
RUN cp ./scripts/entrypoint.sh /usr/local/bin/entry-almobi; \
3241
cp ./scripts/nginx.conf /etc/nginx/sites-available/default; \
3342
cp ./scripts/supervisor.ini /etc/supervisor/supervisord.conf; \
43+
cp ./scripts/opcache.ini /usr/local/etc/php/conf.d/opcache.ini; \
3444
chmod +x /usr/local/bin/entry-almobi;
3545

3646
EXPOSE 8000

readme.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
A base project that serves for Laravel development projects
44

55
## How to build an image?
6-
Just run the docker build command informing the folder where the Dockerimage is located and informing the version in the TAG.
6+
7+
Just run the docker build command informing the folder where the Dockerimage is located and informing the version in the
8+
TAG.
79

810
````bash
911
$ docker build . --file php/7.4/Dockerfile --tag anave/php-laravel:7.4
1012
````
1113

1214
## How to publish the image?
13-
After building the image, we will publish it on the Docker hub, for that use the command below informing the images built previously.
15+
16+
After building the image, we will publish it on the Docker hub, for that use the command below informing the images
17+
built previously.
1418

1519
```bash
1620
$ docker push anave/php-laravel:7.4
@@ -25,6 +29,7 @@ It uses Alpine Linux as a development base.
2529
`Mysql`, `Sqlite`, `LibPng`, `Curl`, `XML`, `Zip` and others are already installed.
2630

2731
The PHP Extensions
32+
2833
- `pdo_mysql`
2934
- `pdo_sqlite`
3035
- `mbstring`
@@ -40,4 +45,24 @@ The PHP Extensions
4045

4146
`dockerize` is already installed.
4247

43-
and `Composer` in the latest version.
48+
and `Composer` in the latest version.
49+
50+
## How to use OPCache for local development?
51+
52+
To use the image with OPCache active for production, just override the environment variable when running the image.
53+
54+
```ini
55+
PHP_OPCACHE_VALIDATE_TIMESTAMPS = 1
56+
```
57+
58+
The variables that are enabled for override are:
59+
60+
```Dockerfile
61+
ENV PHP_OPCACHE_ENABLE=1
62+
ENV PHP_OPCACHE_REVALIDATE_FREQ=0
63+
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0
64+
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES=10000
65+
ENV PHP_OPCACHE_MEMORY_CONSUMPTION=192
66+
ENV PHP_OPCACHE_MAX_WASTED_PERCENTAGE=10
67+
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16
68+
```

scripts/opcache.ini

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
opcache.enable = 1
2-
opcache.memory_consumption = 512
3-
opcache.interned_strings_buffer = 64
4-
opcache.max_accelerated_files = 30000
5-
opcache.validate_timestamps = 0
6-
opcache.save_comments = 1
1+
[opcache]
2+
opcache.enable = ${PHP_OPCACHE_ENABLE}
3+
opcache.revalidate_freq = ${PHP_OPCACHE_REVALIDATE_FREQ}
4+
opcache.validate_timestamps = ${PHP_OPCACHE_VALIDATE_TIMESTAMPS}
5+
opcache.max_accelerated_files = ${PHP_OPCACHE_MAX_ACCELERATED_FILES}
6+
opcache.memory_consumption = ${PHP_OPCACHE_MEMORY_CONSUMPTION}
7+
opcache.max_wasted_percentage = ${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}
8+
opcache.interned_strings_buffer = ${PHP_OPCACHE_INTERNED_STRINGS_BUFFER}
9+
opcache.fast_shutdown = 1

0 commit comments

Comments
 (0)