Commit 9d9498ad authored by Tobias Munk's avatar Tobias Munk

removed standalone fpm image

parent 8d3d5286
Pipeline #58683 failed with stages
in 2 minutes and 4 seconds
stages: stages:
- php-build - build
- php-test - test
- nginx-build - release
- nginx-test
- php-release
- nginx-release
- cleanup - cleanup
variables: variables:
...@@ -14,7 +11,6 @@ before_script: ...@@ -14,7 +11,6 @@ before_script:
- export ISOLATION=buildpipeline${CI_PIPELINE_ID} - export ISOLATION=buildpipeline${CI_PIPELINE_ID}
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME} - export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- export PHP_BASE_IMAGE_VERSION=7.4 - 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 STACK_PHP_IMAGE=${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}
- export REGISTRY_PHP_IMAGE=${PHP_IMAGE_NAME}:${CI_BUILD_REF_NAME} - export REGISTRY_PHP_IMAGE=${PHP_IMAGE_NAME}:${CI_BUILD_REF_NAME}
- export REGISTRY_PHP_IMAGE_LATEST=${PHP_IMAGE_NAME}:latest - export REGISTRY_PHP_IMAGE_LATEST=${PHP_IMAGE_NAME}:latest
...@@ -29,22 +25,18 @@ after_script: ...@@ -29,22 +25,18 @@ after_script:
- export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME} - export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
- docker-compose down -v - docker-compose down -v
build:php:
stage: php-build
script:
- docker-compose build --pull php
test:php: test:php:
stage: php-test stage: test
script: script:
- export PHP_SERVICE=php - export PHP_SERVICE=php-nginx
- sh test/prod.sh - sh test/prod.sh
- sh test/dev.sh - sh test/dev.sh
- sh test/debug.sh - sh test/debug.sh
- docker-compose run --rm php php /test/requirements.php - docker-compose run --rm php php /test/requirements.php
test:php:allow-fail: test:php:allow-fail:
stage: php-test stage: test
script: script:
- cd php - cd php
- docker run --rm ${STACK_PHP_IMAGE} sh -c 'composer global update --dry-run; composer diagnose' - docker run --rm ${STACK_PHP_IMAGE} sh -c 'composer global update --dry-run; composer diagnose'
...@@ -52,40 +44,21 @@ test:php:allow-fail: ...@@ -52,40 +44,21 @@ test:php:allow-fail:
except: except:
- tags - tags
release:php:latest:
stage: php-release
only:
- latest
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 logout ${REGISTRY_HOST}
release:php:tags:
stage: php-release
only:
- tags
script:
- docker login --username ${REGISTRY_USER} --password ${REGISTRY_PASS} ${REGISTRY_HOST}
- docker tag ${STACK_PHP_IMAGE} ${REGISTRY_PHP_IMAGE}
- docker push ${REGISTRY_PHP_IMAGE}
- docker logout ${REGISTRY_HOST}
build:php-nginx: build:php-nginx:
stage: nginx-build stage: build
script: script:
- cd nginx - cd nginx
# use locally built image # use locally built image
- docker-compose build php-nginx - docker-compose build php-nginx
test:php-nginx: test:php-nginx:
stage: nginx-test stage: test
script: script:
- docker-compose run --rm php-nginx nginx -v - docker-compose run --rm php-nginx nginx -v
release:nginx:latest: release:nginx:latest:
stage: nginx-release stage: release
only: only:
- latest - latest
script: script:
...@@ -95,7 +68,7 @@ release:nginx:latest: ...@@ -95,7 +68,7 @@ release:nginx:latest:
- docker logout ${REGISTRY_HOST} - docker logout ${REGISTRY_HOST}
release:nginx:tags: release:nginx:tags:
stage: nginx-release stage: release
only: only:
- tags - tags
script: script:
......
...@@ -18,6 +18,7 @@ Changelog ...@@ -18,6 +18,7 @@ Changelog
### 8.x ### 8.x
- using updated yii2 images, different system package installation - using updated yii2 images, different system package installation
- removed standalone `fpm` image
### 7.x ### 7.x
......
version: '2' version: '2'
services: services:
php:
build:
dockerfile: Dockerfile-fpm
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}
volumes:
- ./test:/test
php-nginx: php-nginx:
build: build:
dockerfile: Dockerfile-fpm-nginx dockerfile: Dockerfile-fpm-nginx
context: 'nginx' context: 'nginx'
args: args:
- PHP_IMAGE_VERSION=${PHP_IMAGE_VERSION} - PHP_BASE_IMAGE_VERSION=${PHP_BASE_IMAGE_VERSION}
image: ${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}-nginx image: ${PHP_IMAGE_NAME}:${PHP_BASE_IMAGE_VERSION}-nginx
environment: environment:
- GITHUB_API_TOKEN=${GITHUB_API_TOKEN}
- PHP_ENABLE_XDEBUG=${PHP_ENABLE_XDEBUG} - PHP_ENABLE_XDEBUG=${PHP_ENABLE_XDEBUG}
volumes: volumes:
- ./test:/test
- ./test/app/web:/app/web - ./test/app/web:/app/web
ports: ports:
- 80 - 80
......
ARG PHP_IMAGE_VERSION # PHP Docker image for Yii 2.0 Framework runtime
FROM dmstr/php-yii2:${PHP_IMAGE_VERSION} # ==============================================
# Install nginx ARG PHP_BASE_IMAGE_VERSION
RUN apt-get update \ FROM yiisoftware/yii2-php:${PHP_BASE_IMAGE_VERSION}-fpm
&& apt-get install -y --force-yes \
# 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 && \
apt-key update && \
apt-get update && \
apt-get -y install \
git \
nano \
npm \
default-mysql-client \
nginx-full \ nginx-full \
cron \ cron \
supervisor \ supervisor \
procps \ procps \
--no-install-recommends && \ --no-install-recommends && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install less-compiler
RUN npm -g install \
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 # Add configuration files
COPY image-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"]
# forward request and error logs to docker log collector # forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \ RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \ && ln -sf /dev/stderr /var/log/nginx/error.log \
......
# 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 && \
apt-key update && \
apt-get update && \
apt-get -y install \
git \
nano \
npm \
default-mysql-client \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install less-compiler
RUN npm -g install \
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"]
#!/usr/bin/env bash #!/usr/bin/env bash
PHP_SERVICE=${PHP_SERVICE-php} PHP_SERVICE=${PHP_SERVICE-php-nginx}
echo "Running one-off command with xdebug" echo "Running one-off command with xdebug"
PHP_ENABLE_XDEBUG=1 docker-compose run ${PHP_SERVICE} php -i | grep xdebug PHP_ENABLE_XDEBUG=1 docker-compose run ${PHP_SERVICE} php -i | grep xdebug
......
#!/usr/bin/env bash #!/usr/bin/env bash
PHP_SERVICE=${PHP_SERVICE-php} PHP_SERVICE=${PHP_SERVICE-php-nginx}
echo "Checking composer..." echo "Checking composer..."
docker-compose run --rm ${PHP_SERVICE} composer --version || exit 1 docker-compose run --rm ${PHP_SERVICE} composer --version || exit 1
...@@ -14,4 +14,4 @@ docker-compose run --rm ${PHP_SERVICE} git --version || exit 1 ...@@ -14,4 +14,4 @@ docker-compose run --rm ${PHP_SERVICE} git --version || exit 1
echo "Checking npm..." echo "Checking npm..."
docker-compose run --rm ${PHP_SERVICE} npm --version || exit 1 docker-compose run --rm ${PHP_SERVICE} npm --version || exit 1
echo "Done." echo "Done."
\ No newline at end of file
#!/usr/bin/env bash #!/usr/bin/env bash
PHP_SERVICE=${PHP_SERVICE-php} PHP_SERVICE=${PHP_SERVICE-php-nginx}
docker-compose run --rm ${PHP_SERVICE} php --version docker-compose run --rm ${PHP_SERVICE} php --version
# this would match even if module is not loaded, eg. when commented out in opcache.ini # this would match even if module is not loaded, eg. when commented out in opcache.ini
......
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