Commit 6f8445a7 authored by Tobias Munk's avatar Tobias Munk

Merge branch 'feature/7.3' into release/6.x

parents a9a6acb1 94ab815c
......@@ -13,7 +13,7 @@ variables:
before_script:
- export ISOLATION=buildpipeline${CI_PIPELINE_ID}
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- export PHP_BASE_IMAGE_VERSION=7.2
- export PHP_BASE_IMAGE_VERSION=7.3
- 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}
......@@ -34,11 +34,6 @@ build:php:
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:
......@@ -48,15 +43,6 @@ 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
- sh test/debug.sh
- docker-compose run --rm php-alpine php /test/requirements.php
test:php:allow-fail:
stage: php-test
script:
......@@ -80,8 +66,6 @@ release:php:latest:
- 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
release:php:tags:
stage: php-release
......@@ -91,10 +75,6 @@ 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
build:php-nginx:
stage: nginx-build
......@@ -103,23 +83,11 @@ build:php-nginx:
# use locally built image
- docker-compose build php-nginx
build:php-alpine-nginx:
stage: nginx-build
script:
- cd nginx
# use locally built image
- docker-compose build php-alpine-nginx
test:php-nginx:
stage: nginx-test
script:
- docker-compose run --rm php-nginx nginx -v
test:php-alpine-nginx:
stage: nginx-test
script:
- docker-compose run --rm php-alpine-nginx nginx -v
release:nginx:latest:
stage: nginx-release
only:
......@@ -128,8 +96,6 @@ release:nginx:latest:
- 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
release:nginx:tags:
stage: nginx-release
......@@ -139,5 +105,3 @@ release:nginx:tags:
- 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:
docker-compose build --pull php
docker-compose build --pull php-nginx
docker-compose build --pull php-alpine
docker-compose build --pull php-alpine-nginx
push-all:
git remote | xargs -L1 git push --all
lint:
docker run -it --rm -v "$(PWD)/php/Dockerfile-fpm":/Dockerfile:ro redcoolbeans/dockerlint
docker run -it --rm -v "$(PWD)/php/Dockerfile-fpm-alpine":/Dockerfile:ro redcoolbeans/dockerlint
\ No newline at end of file
......@@ -3,11 +3,11 @@ Supported tags and respective `Dockerfile` links
- `7.x-fpm-x.x`, `latest` ([Dockerfile](php/Dockerfile-fpm))
- `7.x-fpm-x.x-nginx`, `latest-nginx` ([Dockerfile](nginx/Dockerfile-fpm-nginx))
- `7.x-fpm-x.x-alpine`, `latest-alpine` ([Dockerfile](php/Dockerfile-fpm))
- `7.x-fpm-x.x-alpine-nginx`, `latest-alpine-nginx` ([Dockerfile](nginx/Dockerfile-fpm-alpine-nginx))
*`latest` images are currently built based on the `release/4.x` branch*
*Alpine support has been dropped since PHP 7.3*
:information_source: See repository tags for full version numbers
See all available [image tags](https://hub.docker.com/r/dmstr/php-yii2/tags/)
......@@ -51,7 +51,7 @@ Features
- opcache
- pdo_mysql
- pdo_pgsql
- memcache - *Alpine only*
- memcache
- xdebug - *installed, but not loaded by default*
Configuration
......
......@@ -27,25 +27,3 @@ services:
ports:
- 80
- 443
php-alpine:
build:
dockerfile: Dockerfile-fpm-alpine
context: 'php'
args:
- PHP_BASE_IMAGE_VERSION=${PHP_BASE_IMAGE_VERSION}
image: ${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}-alpine
volumes:
- ./test:/test
php-alpine-nginx:
build:
dockerfile: Dockerfile-fpm-alpine-nginx
context: 'nginx'
args:
- PHP_IMAGE_VERSION=${PHP_IMAGE_VERSION}
image: ${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}-alpine-nginx
volumes:
- ./test/app/web:/app/web
ports:
- 80
- 443
ARG PHP_IMAGE_VERSION
FROM dmstr/php-yii2:${PHP_IMAGE_VERSION}-alpine
# Install nginx
RUN apk --update add nginx supervisor
# 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 ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
EXPOSE 80 443
\ No newline at end of file
......@@ -15,19 +15,19 @@ RUN apt-get update && \
apt-get -y install \
g++ \
git \
bash-completion \
curl \
imagemagick \
libfreetype6-dev \
libcurl3-dev \
libicu-dev \
libmcrypt-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg62-turbo-dev \
libmagickwand-dev \
libmcrypt-dev \
libpq-dev \
libpng-dev \
libzip-dev \
zlib1g-dev \
mysql-client \
openssh-client \
......@@ -63,9 +63,8 @@ RUN docker-php-ext-configure gd \
# Install PECL extensions
# see http://stackoverflow.com/a/8154466/291573) for usage of `printf`
RUN printf "\n" | pecl install \
apcu-5.1.3 \
imagick \
mcrypt-1.0.0 && \
apcu-5.1.14 \
imagick && \
docker-php-ext-enable \
apcu \
imagick
......@@ -74,7 +73,7 @@ RUN printf "\n" | pecl install \
RUN cd /tmp && \
git clone git://github.com/xdebug/xdebug.git && \
cd xdebug && \
git checkout 52adff7539109db592d07d3f6c325f6ee2a7669f && \
git checkout tags/2.7.0beta1 && \
phpize && \
./configure --enable-xdebug && \
make && \
......@@ -88,6 +87,10 @@ RUN npm install -g \
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
ENV PHP_USER_ID=33 \
PHP_ENABLE_XDEBUG=0 \
VERSION_COMPOSER_ASSET_PLUGIN=^1.4.3 \
......
# PHP Docker image for Yii 2.0 Framework runtime
# ==============================================
ARG PHP_BASE_IMAGE_VERSION
FROM php:${PHP_BASE_IMAGE_VERSION}-fpm-alpine
# Install system packages & PHP extensions required for Yii 2.0 Framework
RUN apk --update --virtual build-deps add \
autoconf \
make \
gcc \
g++ \
libtool \
icu-dev \
curl-dev \
freetype-dev \
imagemagick-dev \
pcre-dev \
postgresql-dev \
libmcrypt-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev && \
apk add \
git \
curl \
bash \
bash-completion \
icu \
imagemagick \
pcre \
freetype \
libmcrypt \
libintl \
libjpeg-turbo \
libpng \
libltdl \
libxml2 \
mysql-client \
nodejs-npm \
postgresql && \
pecl install \
apcu \
imagick \
mcrypt-1.0.0 && \
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 \
zip \
curl \
bcmath \
exif \
gd \
iconv \
intl \
mbstring \
opcache \
pdo_mysql \
pdo_pgsql && \
apk del \
build-deps
RUN echo "extension=apcu.so" > /usr/local/etc/php/conf.d/pecl-apcu.ini \
&& echo "extension=imagick.so" > /usr/local/etc/php/conf.d/pecl-imagick.ini
# memcache
ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev git
RUN set -xe \
&& 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
# Install xdebug
RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" && \
apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS && \
cd /tmp && \
git clone git://github.com/xdebug/xdebug.git && \
cd xdebug && \
git checkout 52adff7539109db592d07d3f6c325f6ee2a7669f && \
phpize && \
./configure --enable-xdebug && \
make && \
make install && \
rm -rf /tmp/xdebug && \
apk del .phpize-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.3 \
VERSION_PRESTISSIMO_PLUGIN=^0.3.0 \
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"]
......@@ -14,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
extension=mcrypt.so
\ No newline at end of file
......@@ -9,9 +9,6 @@ docker-compose run --rm ${PHP_SERVICE} php --version
echo "Checking GDlib..."
docker-compose run --rm ${PHP_SERVICE} php -m | grep -i gd 1>/dev/null || exit 1
echo "Checking mcrypt..."
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
......
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