Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 9 additions & 34 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,14 @@ jobs:
strategy:
matrix:
php: [7.2, 7.3, 7.4]
kind: [fpm-alpine, fpm-alpine-develop, fpm-alpine-develop-xdebug, cli-alpine]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the graycore/magento-php:${{ matrix.php }}-fpm-alpine image
run: docker build ./php/${{ matrix.php }}/alpine
-t graycore/magento-php:${{ matrix.php }}-fpm-alpine-${GITHUB_REF##*/}
-t graycore/magento-php:${{ matrix.php }}-fpm-alpine

- name: Build the graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop image
run: docker build ./php/${{ matrix.php }}/alpine-develop
-t graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-${GITHUB_REF##*/}
-t graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop

- name: Build the graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug image
run: docker build ./php/${{ matrix.php }}/alpine-develop-xdebug
-t graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug-${GITHUB_REF##*/}
-t graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug
- name: Build the graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }} image
run: docker build ./php/${{ matrix.php }}/${{ matrix.kind }}
-t graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }}-${GITHUB_REF##*/}
-t graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }}

- name: Login to registry
run: docker login -u $DOCKER_USER -p $DOCKER_PASS
Expand All @@ -39,29 +30,13 @@ jobs:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}

- name: Publish latest graycore/magento-php:${{ matrix.php }}-fpm-alpine image
if: ${{ github.event_name == 'release' }}
run: docker push graycore/magento-php:${{ matrix.php }}-fpm-alpine

- name: Publish tag graycore/magento-php:${{ matrix.php }}-fpm-alpine-${GITHUB_REF##*/} image
if: ${{ github.event_name == 'release' }}
run: docker push graycore/magento-php:${{ matrix.php }}-fpm-alpine-${GITHUB_REF##*/}

- name: Publish latest graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop image
if: ${{ github.event_name == 'release' }}
run: docker push graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop

- name: Publish tag graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-${GITHUB_REF##*/} image
- name: Publish latest graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }} image
if: ${{ github.event_name == 'release' }}
run: docker push graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-${GITHUB_REF##*/}

- name: Publish latest graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug image
if: ${{ github.event_name == 'release' }}
run: docker push graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug
run: docker push graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }}

- name: Publish tag graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug-${GITHUB_REF##*/} image
- name: Publish tag graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }}-${GITHUB_REF##*/} image
if: ${{ github.event_name == 'release' }}
run: docker push graycore/magento-php:${{ matrix.php }}-fpm-alpine-develop-xdebug-${GITHUB_REF##*/}
run: docker push graycore/magento-php:${{ matrix.php }}-${{ matrix.kind }}-${GITHUB_REF##*/}
build-nginx:
strategy:
matrix:
Expand Down
41 changes: 41 additions & 0 deletions php/7.2/cli-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM php:7.2-cli-alpine

LABEL maintainer="damien@graycore.io"

RUN apk add --no-cache \
gzip \
freetype-dev \
icu-dev \
libjpeg-turbo-dev \
libpng-dev \
libxslt-dev \
lsof \
curl-dev \
libsodium-dev \
mysql-client \
procps \
zip

# https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html#required-php-extensions
# This layer must be run as one, not two - See: https://github.com/docker-library/php/issues/855
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install \
bcmath \
gd \
intl \
opcache \
pdo_mysql \
soap \
xsl \
zip \
sockets

RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer && \
composer self-update --1

COPY conf/php.ini /usr/local/etc/php/

RUN chmod 775 /var/www/html && chown root:root /var/www/html

WORKDIR /var/www/html
89 changes: 89 additions & 0 deletions php/7.2/fpm-alpine/conf/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Stock PHP Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.
; Value "stderr" sends the errors to stderr instead of stdout.
display_errors = Off

; The display of errors which occur during PHP's startup sequence are handled
; separately from display_errors.
display_startup_errors = Off

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below.
log_errors = On

; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for.
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

; This sets the maximum amount of memory in bytes that a script is allowed to allocate.
; This helps prevent poorly written scripts for eating up all available memory on a server.
; Note that to have no memory limit, set this directive to -1.
memory_limit = 4G

; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.
; This helps prevent poorly written scripts from tying up the server.
; The default setting is 30. When running PHP from the command line the default setting is 0.
max_execution_time = 30

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
max_input_time = 30

; The maximum size of an uploaded file. When an integer is used, the value is measured in bytes.
; Shorthand notation may also be used.
upload_max_filesize = 20M

; Sets max size of post data allowed. This setting also affects file upload. To upload large files,
; this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be
; larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used.
post_max_size = 20M

; Whether to transparently compress pages. If this option is set to "On" in php.ini or the Apache configuration,
; pages are compressed if the browser sends an "Accept-Encoding: gzip" or "deflate" header.
; "Content-Encoding: gzip" (respectively "deflate") and "Vary: Accept-Encoding" headers are added to the output.
zlib.output_compression = On

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; OPcache Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Determines if Zend OPCache is enabled
opcache.enable = 1

; The maximum number of keys (and therefore scripts) in the OPcache hash table.
; The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }
; that is greater than or equal to the configured value. The minimum value is 200.
; The maximum value is 1000000. Values outside of this range are clamped to the permissible range.
;
; After running some tests on Magento 2 instances, the typical file count is around 30000. We use double, just in case.
opcache.max_accelerated_files = 65407

; When enabled, the opcode cache will be checked for whether a file has already been cached when file_exists(), is_file() and is_readable() are called.
; This may increase performance in applications that check the existence and readability of PHP scripts, but risks returning stale data if opcache.validate_timestamps is disabled.
opcache.enable_file_override = 1

;The amount of memory used to store interned strings, in megabytes.
opcache.interned_strings_buffer = 32

; The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set.
opcache.memory_consumption = 200

; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.
; This configuration directive is ignored if opcache.validate_timestamps is disabled.

; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds. When this directive is disabled, you must reset OPcache manually via opcache_reset(),
; opcache_invalidate() or by restarting the Web server for changes to the filesystem to take effect.
;
; Since we're using a dockerized environment, we're assuming that the final environment is immutable, and therefore validating timestamps
; is unnecessary.
opcache.validate_timestamps = 0

; If disabled, all documentation comments will be discarded from the opcode cache to reduce the size of the optimised code.
; Disabling this configuration directive may break applications and frameworks that rely on comment parsing for annotations,
; including Doctrine, Zend Framework 2, PHPUnit, and Magento 2.
opcache.save_comments = 1
40 changes: 40 additions & 0 deletions php/7.3/cli-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM php:7.3-cli-alpine

LABEL maintainer="damien@graycore.io"

RUN apk add --no-cache \
gzip \
freetype-dev \
icu-dev \
libjpeg-turbo-dev \
libpng-dev \
libxslt-dev \
lsof \
curl-dev \
libsodium-dev \
libzip-dev \
mysql-client \
procps

# https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html#required-php-extensions
# This layer must be run as one, not two - See: https://github.com/docker-library/php/issues/855
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install \
bcmath \
gd \
intl \
opcache \
pdo_mysql \
soap \
xsl \
zip \
sockets

RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer

COPY conf/php.ini /usr/local/etc/php/

RUN chmod 775 /var/www/html && chown root:root /var/www/html

WORKDIR /var/www/html
41 changes: 41 additions & 0 deletions php/7.4/cli-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM php:7.4-cli-alpine

LABEL maintainer="damien@graycore.io"

RUN apk add --no-cache \
gzip \
freetype-dev \
icu-dev \
libjpeg-turbo-dev \
libpng-dev \
libxslt-dev \
lsof \
curl-dev \
libzip-dev \
libsodium-dev \
mysql-client \
procps

# https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html#required-php-extensions
# This layer must be run as one, not two - See: https://github.com/docker-library/php/issues/855
RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
&& docker-php-ext-install \
bcmath \
gd \
intl \
opcache \
pdo_mysql \
soap \
xsl \
zip \
sockets

RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer && \
composer self-update

COPY conf/php.ini /usr/local/etc/php/

RUN chmod 775 /var/www/html && chown root:root /var/www/html

WORKDIR /var/www/html
84 changes: 84 additions & 0 deletions php/7.4/cli-alpine/conf/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Stock PHP Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.
; Value "stderr" sends the errors to stderr instead of stdout.
display_errors = Off

; The display of errors which occur during PHP's startup sequence are handled
; separately from display_errors.
display_startup_errors = Off

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below.
log_errors = On

; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for.
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

; This sets the maximum amount of memory in bytes that a script is allowed to allocate.
; This helps prevent poorly written scripts for eating up all available memory on a server.
; Note that to have no memory limit, set this directive to -1.
memory_limit = 4G

; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.
; This helps prevent poorly written scripts from tying up the server.
; The default setting is 30. When running PHP from the command line the default setting is 0.
max_execution_time = 30

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
max_input_time = 30

; The maximum size of an uploaded file. When an integer is used, the value is measured in bytes.
; Shorthand notation may also be used.
upload_max_filesize = 20M

; Sets max size of post data allowed. This setting also affects file upload. To upload large files,
; this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be
; larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used.
post_max_size = 20M

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; OPcache Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Determines if Zend OPCache is enabled
opcache.enable = 1

; The maximum number of keys (and therefore scripts) in the OPcache hash table.
; The actual value used will be the first number in the set of prime numbers { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }
; that is greater than or equal to the configured value. The minimum value is 200.
; The maximum value is 1000000. Values outside of this range are clamped to the permissible range.
;
; After running some tests on Magento 2 instances, the typical file count is around 30000. We use double, just in case.
opcache.max_accelerated_files = 65407

; When enabled, the opcode cache will be checked for whether a file has already been cached when file_exists(), is_file() and is_readable() are called.
; This may increase performance in applications that check the existence and readability of PHP scripts, but risks returning stale data if opcache.validate_timestamps is disabled.
opcache.enable_file_override = 1

;The amount of memory used to store interned strings, in megabytes.
opcache.interned_strings_buffer = 32

; The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set.
opcache.memory_consumption = 200

; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.
; This configuration directive is ignored if opcache.validate_timestamps is disabled.

; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds. When this directive is disabled, you must reset OPcache manually via opcache_reset(),
; opcache_invalidate() or by restarting the Web server for changes to the filesystem to take effect.
;
; Since we're using a dockerized environment, we're assuming that the final environment is immutable, and therefore validating timestamps
; is unnecessary.
opcache.validate_timestamps = 0

; If disabled, all documentation comments will be discarded from the opcode cache to reduce the size of the optimised code.
; Disabling this configuration directive may break applications and frameworks that rely on comment parsing for annotations,
; including Doctrine, Zend Framework 2, PHPUnit, and Magento 2.
opcache.save_comments = 1
Loading