Commit e82a86f2 authored by Tobias Munk's avatar Tobias Munk

Merge branch 'release/7.x'

parents 8c34e777 a6c5ea54
Pipeline #58606 failed with stages
in 29 seconds
STACK_PHP_IMAGE=local/dmstr/php-yii2
GITHUB_API_TOKEN=0000000000000000000000000000000000000000
\ No newline at end of file
PHP_IMAGE_NAME=local/dmstr/php-yii2
PHP_IMAGE_VERSION=latest
GITHUB_API_TOKEN=0000000000000000000000000000000000000000
PHP_BASE_IMAGE_VERSION=7.4
stages:
- php-build
- php-test
- php-release
- nginx-build
- nginx-test
- php-release
- nginx-release
- nginx-xdebug-build
- nginx-xdebug-test
- nginx-xdebug-release
- cleanup
variables:
PHP_IMAGE_NAME: dmstr/php-yii2
before_script:
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- export APP_VERSION=$(git describe --always --dirty)
- export PHP_IMAGE_NAME=dmstr/php-yii2
- export STACK_PHP_IMAGE=${PHP_IMAGE_NAME}:${APP_VERSION}
- export PHP_BASE_IMAGE_VERSION=7.4
- export PHP_IMAGE_VERSION=$(git describe --always --dirty --tags)
- export STACK_PHP_IMAGE=${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}
- export REGISTRY_PHP_IMAGE=${PHP_IMAGE_NAME}:${CI_BUILD_REF_NAME}
- export REGISTRY_PHP_IMAGE_LATEST=${PHP_IMAGE_NAME}:latest
- echo "Building image"
- echo ${STACK_PHP_IMAGE}
- echo "Build-environment information"
# Docker >= 17.05 required for dynamic FROM references
- docker version
- docker-compose config
- docker images ${PHP_IMAGE_NAME}
after_script:
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- docker-compose down -v
build:php:
stage: php-build
script:
- docker-compose build --pull php
build:php-alpine:
stage: php-build
script:
- docker-compose build --pull php-alpine
test:php:
stage: php-test
script:
......@@ -47,18 +43,10 @@ test:php:
- sh test/debug.sh
- docker-compose run --rm php php /test/requirements.php
test:php-alpine:
stage: php-test
script:
- export PHP_SERVICE=php-alpine
- sh test/prod.sh
- sh test/dev.sh
- docker-compose run --rm php-alpine php /test/requirements.php
test:php:allow-fail:
stage: php-test
script:
- cd php-7.1
- cd php
- docker run --rm ${STACK_PHP_IMAGE} sh -c 'composer global update --dry-run; composer diagnose'
allow_failure: true
except:
......@@ -67,20 +55,18 @@ test:php:allow-fail:
lint:php:
stage: php-test
script:
- cd php-7.1
- cd php
- docker-compose run --rm php composer global show
release:php:latest:
stage: php-release
only:
- latest
- tags
script:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE} ${REGISTRY_PHP_IMAGE_LATEST}
- docker push ${REGISTRY_PHP_IMAGE_LATEST}
- docker tag ${STACK_PHP_IMAGE}-alpine ${REGISTRY_PHP_IMAGE_LATEST}-alpine
- docker push ${REGISTRY_PHP_IMAGE_LATEST}-alpine
- docker logout ${REGISTRY_HOST}
release:php:tags:
stage: php-release
......@@ -90,43 +76,31 @@ release:php:tags:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE} ${REGISTRY_PHP_IMAGE}
- docker push ${REGISTRY_PHP_IMAGE}
- docker tag ${STACK_PHP_IMAGE}-alpine ${REGISTRY_PHP_IMAGE}-alpine
- docker push ${REGISTRY_PHP_IMAGE}-alpine
- docker logout ${REGISTRY_HOST}
build:php-nginx:
stage: nginx-build
script:
- cd nginx
- docker-compose build --pull php-nginx
build:php-alpine-nginx:
stage: nginx-build
script:
- cd nginx
- docker-compose build --pull php-alpine-nginx
# use locally built image
- docker-compose build php-nginx
test:php-alpine-nginx:
test:php-nginx:
stage: nginx-test
script:
- sh test/prod.sh
- sh test/dev.sh
- docker-compose run --rm php-alpine-nginx nginx -v
- docker-compose run --rm php-nginx nginx -v
release:nginx:latest:
stage: nginx-release
only:
- latest
- tags
script:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE}-nginx ${REGISTRY_PHP_IMAGE_LATEST}-nginx
- docker push ${REGISTRY_PHP_IMAGE_LATEST}-nginx
- docker tag ${STACK_PHP_IMAGE}-alpine-nginx ${REGISTRY_PHP_IMAGE_LATEST}-alpine-nginx
- docker push ${REGISTRY_PHP_IMAGE_LATEST}-alpine-nginx
- docker logout ${REGISTRY_HOST}
release:nginx:tag:
release:nginx:tags:
stage: nginx-release
only:
- tags
......@@ -134,38 +108,4 @@ release:nginx:tag:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE}-nginx ${REGISTRY_PHP_IMAGE}-nginx
- docker push ${REGISTRY_PHP_IMAGE}-nginx
- docker tag ${STACK_PHP_IMAGE}-alpine-nginx ${REGISTRY_PHP_IMAGE}-alpine-nginx
- docker push ${REGISTRY_PHP_IMAGE}-alpine-nginx
build:php-alpine-nginx-xdebug:
stage: nginx-xdebug-build
script:
- cd nginx
- docker-compose build --pull php-alpine-nginx-xdebug
test:php-alpine-nginx-xdebug:
stage: nginx-xdebug-test
script:
- sh test/debug.sh
release:php-alpine-nginx-xdebug:latest:
stage: nginx-xdebug-release
only:
- latest
- tags
script:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE}-alpine-nginx-xdebug ${REGISTRY_PHP_IMAGE_LATEST}-alpine-nginx-xdebug
- docker push ${REGISTRY_PHP_IMAGE_LATEST}-alpine-nginx-xdebug
release:php-alpine-nginx-xdebug:tag:
stage: nginx-xdebug-release
only:
- tags
script:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE}-alpine-nginx-xdebug ${REGISTRY_PHP_IMAGE}-alpine-nginx-xdebug
- docker push ${REGISTRY_PHP_IMAGE}-alpine-nginx-xdebug
- docker logout ${REGISTRY_HOST}
build:
docker-compose build --pull
docker-compose build --pull php
docker-compose build --pull php-nginx
push-all:
git remote | xargs -L1 git push --all
lint:
docker run -it --rm -v "$(PWD)/php-7.1/Dockerfile-fpm":/Dockerfile:ro redcoolbeans/dockerlint
docker run -it --rm -v "$(PWD)/php-7.1/Dockerfile-fpm-alpine":/Dockerfile:ro redcoolbeans/dockerlint
\ No newline at end of file
docker run -it --rm -v "$(PWD)/php/Dockerfile-fpm":/Dockerfile:ro redcoolbeans/dockerlint
Supported tags and respective `Dockerfile` links
================================================
- `7.0-fpm-1.9`, `7.0-fpm` ([7.0/fpm/Dockerfile-fpm](php-7.0/Dockerfile-fpm))
- `7.1-fpm-2.0-beta1`, `7.1-fpm`, `latest` ([7.1/fpm/Dockerfile-fpm](php-7.1/Dockerfile-fpm))
- `7.1-fpm-2.0-beta1-nginx`, `7.1-fpm-nginx` ([7.1/fpm/Dockerfile-fpm-nginx](nginx/Dockerfile-fpm-nginx))
- `7.1-fpm-2.0-beta1-alpine-nginx`, `7.1-fpm-alpine-nginx` ([7.1/fpm/Dockerfile-fpm-alpine-nginx](nginx/Dockerfile-fpm-alpine-nginx))
- `7.x-fpm-x.x`, `latest` ([Dockerfile](php/Dockerfile-fpm))
- `7.x-fpm-x.x-nginx`, `latest-nginx` ([Dockerfile](nginx/Dockerfile-fpm-nginx))
:information_source: `7.0-fpm-1.9` is based on PHP *7.0.15*
*`latest` images are currently built based on the `release/4.x` branch*
### Experimental
- :b: `7.0-fpm-1.9-nginx`, `7.0-fpm-nginx` ([7.0/fpm/Dockerfile-fpm-nginx](nginx/Dockerfile-fpm-nginx))
- :b: `7.0-fpm-1.9-alpine-nginx`, `7.0-fpm-alpine-nginx` ([7.0/fpm/Dockerfile-fpm-alpine-nginx](nginx/Dockerfile-fpm-alpine-nginx))
- :a: `7.0-fpm-1.9-alpine-nginx-xdebug`, `7.0-fpm-alpine-nginx-xdebug` ([7.0/fpm/Dockerfile-fpm-alpine-nginx-xdebug](nginx/Dockerfile-fpm-alpine-nginx-xdebug))
- :a: `7.1-fpm-2.0-beta1-alpine-nginx-xdebug`, `7.1-fpm-alpine-nginx-xdebug` ([7.1/fpm/Dockerfile-fpm-alpine-nginx-xdebug](nginx/Dockerfile-fpm-alpine-nginx-xdebug))
:information_source: See repository tags for full version numbers
See all available [image tags](https://hub.docker.com/r/dmstr/php-yii2/tags/)
[![build status](https://git.hrzg.de/dmstr/docker-php-yii2/badges/master/build.svg)](https://git.hrzg.de/dmstr/docker-php-yii2/commits/master)
Changelog
---------
### 6.x
- Alpine support has been dropped
- Forego has been replace with supervisord
- Removed Linkchecker
### 5.x
*no stable release*
### 4.x
- added bash-autocompletion
- removed separate xdebug flavour
Introduction
------------
This is a Docker PHP image containing PHP extensions and composer packages and libraries for *Yii 2.0 Framework*.
It is primarily intended to build Yii 2.0 applications `FROM` this image, see below for available application templates.
There is also an `nginx` flavour available for this image, in which PHP and nginx are managed with forego.
There is also an `nginx` flavour available for this image, in which PHP and nginx are managed with [supervisor](http://supervisord.org/).
In older versions of the `nginx` images, forego was used for process control.
However, since forego is no longer actively maintained and problems can arise if one of the started processes terminates unsuspectedly,
we decided to switch to supervisor.
Features
--------
......@@ -36,18 +51,24 @@ Features
- `composer`
- `codecept`
- `phpunit`
- `yii`
#### Availability matrix
| Command | fpm | fpm-alpine | fpm-alpine-nginx | fpm-alpine-nginx-debug |
|----------|------|------------|------------------|------------------------|
| *xdebug* | :ok: | :x: | :x: | :ok: |
| codecept | :ok: | :ok: | :ok: | :ok: |
| composer | :ok: | :ok: | :ok: | :ok: |
| phpunit | :ok: | :ok: | :ok: | :ok: |
| yii | :ok: | :ok: | :ok: | :ok: |
| npm | :ok: | :ok: | :ok: | :ok: |
- `npm`
#### Extensions
- soap
- zip
- curl
- bcmath
- exif
- gd
- iconv
- intl
- mbstring
- opcache
- pdo_mysql
- pdo_pgsql
- memcache
- xdebug - *installed, but not loaded by default*
Configuration
-------------
......
......@@ -4,8 +4,10 @@ services:
php:
build:
dockerfile: Dockerfile-fpm
context: 'php-7.1'
image: ${STACK_PHP_IMAGE}
context: 'php'
args:
- PHP_BASE_IMAGE_VERSION=${PHP_BASE_IMAGE_VERSION}
image: ${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}
environment:
- GITHUB_API_TOKEN=${GITHUB_API_TOKEN}
- PHP_ENABLE_XDEBUG=${PHP_ENABLE_XDEBUG}
......@@ -15,25 +17,13 @@ services:
build:
dockerfile: Dockerfile-fpm-nginx
context: 'nginx'
image: ${STACK_PHP_IMAGE}-nginx
args:
- PHP_IMAGE_VERSION=${PHP_IMAGE_VERSION}
image: ${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}-nginx
environment:
- PHP_ENABLE_XDEBUG=${PHP_ENABLE_XDEBUG}
php-alpine:
build:
dockerfile: Dockerfile-fpm-alpine
context: 'php-7.1'
image: ${STACK_PHP_IMAGE}-alpine
volumes:
- ./test:/test
php-alpine-nginx:
build:
dockerfile: Dockerfile-fpm-alpine-nginx
context: 'nginx'
image: ${STACK_PHP_IMAGE}-alpine-nginx
php-alpine-nginx-xdebug:
build:
dockerfile: Dockerfile-fpm-alpine-nginx-xdebug
context: 'nginx'
image: ${STACK_PHP_IMAGE}-alpine-nginx-xdebug
- ./test/app/web:/app/web
ports:
- 80
- 443
FROM dmstr/php-yii2:latest-alpine
# Install forego (https://github.com/ddollar/forego/releases/tag/20170327195458)
RUN curl -O https://bin.equinox.io/a/c6JW1BqJwSa/forego-20170327195458-linux-amd64.tar.gz \
&& tar -xzf forego-20170327195458-linux-amd64.tar.gz -C /usr/local/bin
# Install nginx
RUN apk --update add nginx
# Add configuration files, Note: nginx runs under `www-data`
# Note: chmod is a workaround for esotheric permissions issues on Alpine
COPY image-files/ /
RUN chown -R www-data:www-data /var/lib/nginx/ \
&& mkdir -p /var/lib/nginx/tmp \
&& chmod 777 /var/lib/nginx/tmp
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
CMD ["forego", "start", "-r", "-f", "/root/Procfile"]
EXPOSE 80 443
\ No newline at end of file
FROM dmstr/php-yii2:latest-alpine-nginx
RUN apk --no-cache add --virtual .build-deps \
g++ \
autoconf \
make \
&& pecl install xdebug \
&& apk del .build-deps
\ No newline at end of file
FROM dmstr/php-yii2:latest
# Install forego (https://github.com/ddollar/forego/releases/tag/20170327195458)
RUN curl -O https://bin.equinox.io/a/c6JW1BqJwSa/forego-20170327195458-linux-amd64.tar.gz \
&& tar -xzf forego-20170327195458-linux-amd64.tar.gz -C /usr/local/bin
ARG PHP_IMAGE_VERSION
FROM dmstr/php-yii2:${PHP_IMAGE_VERSION}
# Install nginx
RUN apt-get update \
&& apt-get install -y --force-yes \
nginx-full \
cron \
supervisor \
procps \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
......@@ -21,6 +20,6 @@ RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& ln -sf /usr/sbin/cron /usr/sbin/crond
CMD ["forego", "start", "-r", "-f", "/root/Procfile"]
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
EXPOSE 80 443
server {
charset utf-8;
client_max_body_size 512M;
server_name app;
listen 80;
listen 443 ssl http2 default_server;
ssl_certificate /etc/nginx/ssl/nginx-selfsigned.crt;
ssl_certificate_key /etc/nginx/ssl/nginx-selfsigned.key;
root /app/web;
index index.php index.html index.htm;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
}
# define suffixes for static files
# set caching header and avoid processing of non-existing files by Yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|svg|woff|woff2|eot|ttf|otf)$ {
# set expire Header
expires 6M;
#add_header Cache-Control "public";
add_header Last-Modified "";
# keep logs clean
log_not_found off;
try_files $uri =404;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
try_files $uri =404;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
\ No newline at end of file
......@@ -18,7 +18,12 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format logstash_json '{ "@timestamp": "$time_iso8601", '
log_format extended '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time $request_method';
log_format logstash_json '{ "@timestamp": "$time_iso8601", '
'"@fields": { '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
......@@ -31,7 +36,7 @@ http {
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent" } }';
access_log /var/log/nginx/access.log logstash_json;
access_log /var/log/nginx/access.log extended;
sendfile off;
keepalive_timeout 10;
......@@ -63,47 +68,5 @@ http {
# don't use etag with expire
etag off;
server {
charset utf-8;
client_max_body_size 512M;
server_name app;
listen 80;
root /app/web;
index index.php;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
}
# define suffixes for static files
# set caching header and avoid processing of non-existing files by Yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|svg|woff|woff2|eot|ttf|otf)$ {
# set expire Header
expires 6M;
#add_header Cache-Control "public";
add_header Last-Modified "";
# keep logs clean
log_not_found off;
try_files $uri =404;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
try_files $uri =404;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
include /etc/nginx/conf.d/*.conf;
}
-----BEGIN CERTIFICATE-----
MIID3zCCAsegAwIBAgIJAMoMt2gdriBpMA0GCSqGSIb3DQEBCwUAMIGF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zgpqgy5YQbNLg
LlGbVy3J3Chpba7VQL1JZsxq2N8vu20UpVonhxDt0/PqGnCZ+nCWtFmM98iWGrSB
lC5dGBNiD8v/z+T4k3OQFsEpXwKBgQDPYHz0anCXhKNrBK4TJghsxLVOGvoQ7fDO
rw/9fCg19HF2W7aP+sH75Ng+2axzAPpPb2RtoXt1milGB8Km2U+r43J7kls9xpuN
wk/8CdzCvo6iawgCu0q+myuOziYuUGMnixAkEJxsVzrgseNeu8SH++0caOZMTvzL
sM9RDgJapwKBgHtKlfJ6ZrPcYFgm64ZW3EXws5lGFZthUUZ8OY690yucE+IyL6DN
r26CYfs8sZGwz2iFysGYxM6k3iK26pYlKDk7CIPKFDOW+L4helsYj240im2k91Zs
AxFE9UPWf7TjYdlBwhkI63I1CrOxrVVgFGDEQbHLDJJcTVXp94Epg5RrAoGBALM1
Y+ZoUVJvGjXyfmgn1uH//9o2b+HPbel+2aep8qnly2OIEDVOcvK2qbVusJtVvfqF
fdlL0oAnsAFH1YwQgcw+KwHk0ZqKFoUj5bEd6LwWpvZu3iZWKlqbh8HKHq6pY3aZ
s2InRLZPj577u0xzoXwOVrLVaCeLnuR7sD0QiTJDAoGAUewb/2gQNJPKKZCfy4mD
OLXpT/IvV1YElXu8hL2OTElY/l+PCUFQLkmwNP0FXw0Gu4Q0ua05D+BloBWkEPl3
WDheXYwIYiDoZuPAvFGx3WlftXyc7IusJarxY5LQ2q1tl1OwjRV2EeDm+YSTXlSg
Dl+Wm2rCjL43qFrClv7Zjdc=
-----END PRIVATE KEY-----
[program:php-fpm]
command = php-fpm
autostart = true
autorestart = true
priority=40
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'
autostart=true
autorestart=true
priority=50
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
[supervisord]
logfile = /dev/null
loglevel = info
pidfile = /var/run/supervisord.pid
nodaemon = true
[include]
files = /etc/supervisor/conf.d/*.conf
nginx: nginx -g 'daemon off;'
phpfpm: docker-run.sh
cron: crond -f
\ No newline at end of file
# PHP Docker image for Yii 2.0 Framework runtime
# ==============================================
FROM php:7.1.9-fpm
# define build dependency lists
# inherited from PHP base image:
# PHPIZE_DEPS=autoconf dpkg-dev file g++ gcc libc-dev libpcre3-dev make pkg-config re2c
ENV CUSTOM_BUILD_DEPS \
unzip \
libmemcached-dev \
libicu-dev \
libmcrypt-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libxml2-dev \
zlib1g-dev
# list of other packages which could be deinstalled at the end
ENV CUSTOM_REMOVE_LIST cpp \
cpp-4.9 \
g++-4.9 \
gcc-4.9 \
libgcc-4.9-dev \
libhashkit-dev \
libsasl2-dev \
libstdc++-4.9-dev
# Install system packages for PHP extensions recommended for Yii 2.0 Framework
# Install PHP extensions required for Yii 2.0 Framework
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && \
apt-key update && \
apt-get -y install \
$CUSTOM_BUILD_DEPS \
$PHPIZE_DEPS \
git \
mysql-client \
openssh-client \
nano \
linkchecker \
nodejs \
--no-install-recommends && \
npm -g install npm@latest && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ && \
docker-php-ext-configure bcmath && \
docker-php-ext-install gd \
intl \
pdo_mysql \
mbstring \
mcrypt \
opcache \
zip \
bcmath \
soap && \
curl https://codeload.github.com/php-memcached-dev/php-memcached/zip/php7 -o /tmp/memcached.zip \
&& mkdir -p /usr/src/php/ext \
&& unzip /tmp/memcached.zip -d /usr/src/php/ext \
&& docker-php-ext-configure /usr/src/php/ext/php-memcached-php7 --disable-memcached-sasl \
&& docker-php-ext-install /usr/src/php/ext/php-memcached-php7 \
&& rm -rf /usr/src/php/ext/php-memcached-php7 /tmp/memcached.zip && \
printf "\n" | pecl install apcu-5.1.3 xdebug-stable && \
docker-php-ext-enable apcu && \
apt-get remove -y $PHPIZE_DEPS $CUSTOM_BUILD_DEPS $CUSTOM_REMOVE_LIST && \
dpkg --purge $(dpkg -l | awk '/^rc/ { print $2 }') && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install less-compiler
RUN npm install -g \
less \
lesshint \
uglify-js \
uglifycss
ENV PHP_USER_ID=33 \
PHP_ENABLE_XDEBUG=0 \
VERSION_COMPOSER_ASSET_PLUGIN=^1.4.2 \
VERSION_PRESTISSIMO_PLUGIN=^0.3.7 \
PATH=/app:/app/vendor/bin:/root/.composer/vendor/bin:$PATH \
TERM=linux \
COMPOSER_ALLOW_SUPERUSER=1
# Add configuration files
COPY image-files/ /
RUN chmod 700 \
/usr/local/bin/docker-entrypoint.sh \
/usr/local/bin/docker-run.sh \
/usr/local/bin/composer
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer.phar \
--install-dir=/usr/local/bin && \
composer global require --optimize-autoloader \
"fxp/composer-asset-plugin:${VERSION_COMPOSER_ASSET_PLUGIN}" \
"hirak/prestissimo:${VERSION_PRESTISSIMO_PLUGIN}" && \
composer global dumpautoload --optimize && \
composer clear-cache
WORKDIR /app
# Startup script for FPM
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["docker-run.sh"]
# PHP Docker image for Yii 2.0 Framework runtime
# ==============================================
FROM php:7.1.9-fpm-alpine
# Install system packages & PHP extensions required for Yii 2.0 Framework
# virtual pkg names and ENV $PHPIZE_DEPS are definied in base image
# C* and LDFlAGS are also definied in base image, so we use these for our custom pecl builds
# we install (newer) imagick from edge repo due to SEGFAULT bugs
# hopefully this won't break other things...
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS && \
apk add --no-cache --virtual .imagemagick-edge \
--repository http://dl-3.alpinelinux.org/alpine/v3.6/main/ \
--allow-untrusted \
imagemagick \
imagemagick-dev && \
apk add --update --virtual .pecl-build-deps \
icu-dev \
curl-dev \
freetype-dev \
pcre-dev \
postgresql-dev \
libtool \
libmcrypt-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev && \
apk add \
git \
curl \
bash \
bash-completion \
icu \
pcre \
freetype \
libmcrypt \
libintl \
libjpeg-turbo \
imagemagick \
libpng \
libltdl \
libxml2 \
mysql-client \
nodejs \
postgresql-client && \
export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" && \
pecl install \
apcu \
imagick-3.4.3 && \
docker-php-ext-enable imagick && \
docker-php-ext-enable apcu && \
docker-php-ext-configure gd \
--with-gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ && \
docker-php-ext-configure bcmath && \
docker-php-ext-install \
soap \
mcrypt \
zip \
curl \
bcmath \
exif \
gd \
iconv \
intl \
mbstring \
opcache \
pdo_mysql \
pdo_pgsql && \
apk del \
.pecl-build-deps .phpize-deps
# memcache
ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev git
RUN set -xe \
&& apk add libmemcached \
&& apk add --no-cache \
--virtual .memcached-deps \
$MEMCACHED_DEPS \
&& curl https://codeload.github.com/php-memcached-dev/php-memcached/zip/php7 -o /tmp/memcached.zip \
&& mkdir -p /usr/src/php/ext \
&& unzip /tmp/memcached.zip -d /usr/src/php/ext \
&& docker-php-ext-configure /usr/src/php/ext/php-memcached-php7 \
--disable-memcached-sasl \
&& docker-php-ext-install /usr/src/php/ext/php-memcached-php7 \
&& rm -rf /usr/src/php/ext/php-memcached-php7 /tmp/memcached.zip \
&& apk del .memcached-deps
# Install less-compiler
RUN npm install -g \
less \
lesshint \
uglify-js \
uglifycss
# Configure version constraints
ENV PHP_ENABLE_XDEBUG=0 \
VERSION_COMPOSER_ASSET_PLUGIN=^1.4.2 \
VERSION_PRESTISSIMO_PLUGIN=^0.3.7 \
PATH=/app:/app/vendor/bin:/root/.composer/vendor/bin:$PATH \
TERM=linux \
COMPOSER_ALLOW_SUPERUSER=1
# Add configuration files
COPY image-files/ /
# Add GITHUB_API_TOKEN support for composer
RUN chmod 700 \
/usr/local/bin/docker-entrypoint.sh \
/usr/local/bin/docker-run.sh \
/usr/local/bin/composer
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer.phar \
--install-dir=/usr/local/bin && \
composer global require --optimize-autoloader \
"fxp/composer-asset-plugin:${VERSION_COMPOSER_ASSET_PLUGIN}" \
"hirak/prestissimo:${VERSION_PRESTISSIMO_PLUGIN}" && \
composer global dumpautoload --optimize && \
composer clear-cache
WORKDIR /app
# Startup script for FPM
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["docker-run.sh"]
# PHP Docker image for Yii 2.0 Framework runtime
# ==============================================
ARG PHP_BASE_IMAGE_VERSION
FROM yiisoftware/yii2-php:${PHP_BASE_IMAGE_VERSION}-fpm
# Install system packages for PHP extensions recommended for Yii 2.0 Framework
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y install \
gnupg2 && \
curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
apt-key update && \
apt-get update && \
apt-get -y install \
git \
nano \
npm \
--no-install-recommends && \
apt-get clean && \
npm -g install npm@latest && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install less-compiler
RUN npm install -g \
less \
lesshint \
uglify-js \
uglifycss
# Install Yii framework bash autocompletion
RUN curl -L https://raw.githubusercontent.com/yiisoft/yii2/master/contrib/completion/bash/yii \
-o /etc/bash_completion.d/yii
# Add configuration files
COPY image-files/ /
# Add GITHUB_API_TOKEN support for composer
RUN chmod 700 \
/usr/local/bin/docker-entrypoint.sh \
/usr/local/bin/docker-run.sh \
/usr/local/bin/composer
WORKDIR /app
# Startup script for FPM
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["docker-run.sh"]
PS1="\e[0;35m[$APP_NAME] $APP_VERSION \e[0;0m\w \e[0;37m\u \h \e[0;0m\n$ "
cat <<'MSG'
___________
| |
......@@ -12,11 +14,16 @@ cat <<'MSG'
Docker image dmstr/php-yii2
Available commands:
composer
codecept
phpunit
yii
Console commands: composer, codecept, phpunit, yii
MSG
echo "PHP version: ${PHP_VERSION}"
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion.d/yii ]; then
. /etc/bash_completion.d/yii
fi
fi
\ No newline at end of file
......@@ -16,7 +16,5 @@ if [ 0 -ne "${PHP_ENABLE_XDEBUG:-0}" ] ; then
echo "Enabled xdebug"
fi
export PS1="\e[0;35mphd \e[0;37m\u container \h \e[0;32m\w \e[0;0m\n$ "
# Execute CMD
exec "$@"
\ No newline at end of file
......@@ -10,9 +10,9 @@ listen = [::]:9000
pm = dynamic
pm.max_children = 10
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 2
pm.max_requests = 500
; send worker output to stdout/stderr
......
<?php
phpinfo();
\ No newline at end of file
......@@ -3,15 +3,16 @@
PHP_SERVICE=${PHP_SERVICE-php}
echo "Running one-off command with xdebug"
docker-compose run -e PHP_ENABLE_XDEBUG=1 ${PHP_SERVICE} php -i | grep xdebug
PHP_ENABLE_XDEBUG=1 docker-compose run ${PHP_SERVICE} php -i | grep xdebug
echo ""
echo "Starting stack with xdebug"
PHP_ENABLE_XDEBUG=1 docker-compose up -d ${PHP_SERVICE}
sleep 5
docker-compose exec ${PHP_SERVICE} php -i -- | grep xdebug
docker-compose down -v
echo ""
echo "Starting stack without xdebug"
PHP_ENABLE_XDEBUG=0 docker-compose up -d ${PHP_SERVICE}
sleep 5
......
......@@ -2,7 +2,16 @@
PHP_SERVICE=${PHP_SERVICE-php}
echo "Checking composer..."
docker-compose run --rm ${PHP_SERVICE} composer --version || exit 1
echo "Checking mysql client..."
docker-compose run --rm ${PHP_SERVICE} mysql --version || exit 1
echo "Checking git..."
docker-compose run --rm ${PHP_SERVICE} git --version || exit 1
docker-compose run --rm ${PHP_SERVICE} npm --version || exit 1
\ No newline at end of file
echo "Checking npm..."
docker-compose run --rm ${PHP_SERVICE} npm --version || exit 1
echo "Done."
\ No newline at end of file
......@@ -6,14 +6,16 @@ docker-compose run --rm ${PHP_SERVICE} php --version
# this would match even if module is not loaded, eg. when commented out in opcache.ini
# docker-compose run --rm ${PHP_SERVICE} php -i | grep opcache
# better check loaded module list
docker-compose run --rm ${PHP_SERVICE} php -m | grep -i memcached 1>/dev/null || exit 1
echo "Checking GDlib..."
docker-compose run --rm ${PHP_SERVICE} php -m | grep -i gd 1>/dev/null || exit 1
docker-compose run --rm ${PHP_SERVICE} php -m | grep -i mcrypt 1>/dev/null || exit 1
echo "Checking opcache..."
docker-compose run --rm ${PHP_SERVICE} php -m | grep -i opcache 1>/dev/null || exit 1
# check composer auth
echo "Checking composer auth..."
docker-compose run -e GITHUB_API_TOKEN=abcd12345 --rm ${PHP_SERVICE} sh -c '\
composer && \
[ -f ~/.composer/auth.json ] || exit 1 \
'
\ No newline at end of file
'
echo "Done."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment