Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
docker-php-yii2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dmstr
docker-php-yii2
Commits
9d9498ad
Commit
9d9498ad
authored
May 19, 2021
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed standalone fpm image
parent
8d3d5286
Pipeline
#58683
failed with stages
in 2 minutes and 4 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
60 additions
and
109 deletions
+60
-109
.gitlab-ci.yml
.gitlab-ci.yml
+10
-37
README.md
README.md
+1
-0
docker-compose.yml
docker-compose.yml
+4
-14
Dockerfile-fpm-nginx
nginx/Dockerfile-fpm-nginx
+41
-7
.bashrc
nginx/image-files/root/.bashrc
+0
-0
composer
nginx/image-files/usr/local/bin/composer
+0
-0
docker-entrypoint.sh
nginx/image-files/usr/local/bin/docker-entrypoint.sh
+0
-0
docker-run.sh
nginx/image-files/usr/local/bin/docker-run.sh
+0
-0
base.ini
nginx/image-files/usr/local/etc/php/conf.d/base.ini
+0
-0
php-fpm.conf
nginx/image-files/usr/local/etc/php/php-fpm.conf
+0
-0
www.conf
nginx/image-files/usr/local/etc/php/pool.d/www.conf
+0
-0
Dockerfile-fpm
php/Dockerfile-fpm
+0
-47
debug.sh
test/debug.sh
+1
-1
dev.sh
test/dev.sh
+2
-2
prod.sh
test/prod.sh
+1
-1
No files found.
.gitlab-ci.yml
View file @
9d9498ad
stages
:
-
php-build
-
php-test
-
nginx-build
-
nginx-test
-
php-release
-
nginx-release
-
build
-
test
-
release
-
cleanup
variables
:
...
...
@@ -14,7 +11,6 @@ before_script:
-
export ISOLATION=buildpipeline${CI_PIPELINE_ID}
-
export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
-
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
...
...
@@ -29,22 +25,18 @@ after_script:
-
export COMPOSE_PROJECT_NAME=${ISOLATION}${CI_BUILD_NAME}
-
docker-compose down -v
build:php
:
stage
:
php-build
script
:
-
docker-compose build --pull php
test:php
:
stage
:
php-
test
stage
:
test
script
:
-
export PHP_SERVICE=php
-
export PHP_SERVICE=php
-nginx
-
sh test/prod.sh
-
sh test/dev.sh
-
sh test/debug.sh
-
docker-compose run --rm php php /test/requirements.php
test:php:allow-fail
:
stage
:
php-
test
stage
:
test
script
:
-
cd php
-
docker run --rm ${STACK_PHP_IMAGE} sh -c 'composer global update --dry-run; composer diagnose'
...
...
@@ -52,40 +44,21 @@ test:php:allow-fail:
except
:
-
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
:
stage
:
nginx-
build
stage
:
build
script
:
-
cd nginx
# use locally built image
-
docker-compose build php-nginx
test:php-nginx
:
stage
:
nginx-
test
stage
:
test
script
:
-
docker-compose run --rm php-nginx nginx -v
release:nginx:latest
:
stage
:
nginx-
release
stage
:
release
only
:
-
latest
script
:
...
...
@@ -95,7 +68,7 @@ release:nginx:latest:
-
docker logout ${REGISTRY_HOST}
release:nginx:tags
:
stage
:
nginx-
release
stage
:
release
only
:
-
tags
script
:
...
...
README.md
View file @
9d9498ad
...
...
@@ -18,6 +18,7 @@ Changelog
### 8.x
-
using updated yii2 images, different system package installation
-
removed standalone
`fpm`
image
### 7.x
...
...
docker-compose.yml
View file @
9d9498ad
version
:
'
2'
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
:
build
:
dockerfile
:
Dockerfile-fpm-nginx
context
:
'
nginx'
args
:
-
PHP_
IMAGE_VERSION=${PHP
_IMAGE_VERSION}
image
:
${PHP_IMAGE_NAME}:${PHP_IMAGE_VERSION}-nginx
-
PHP_
BASE_IMAGE_VERSION=${PHP_BASE
_IMAGE_VERSION}
image
:
${PHP_IMAGE_NAME}:${PHP_
BASE_
IMAGE_VERSION}-nginx
environment
:
-
GITHUB_API_TOKEN=${GITHUB_API_TOKEN}
-
PHP_ENABLE_XDEBUG=${PHP_ENABLE_XDEBUG}
volumes
:
-
./test:/test
-
./test/app/web:/app/web
ports
:
-
80
...
...
nginx/Dockerfile-fpm-nginx
View file @
9d9498ad
ARG PHP_IMAGE_VERSION
FROM dmstr/php-yii2:${PHP_IMAGE_VERSION}
# PHP Docker image for Yii 2.0 Framework runtime
# ==============================================
# Install nginx
RUN apt-get update \
&& apt-get install -y --force-yes \
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 \
nginx-full \
cron \
supervisor \
procps \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
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"]
# 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 \
...
...
php
/image-files/root/.bashrc
→
nginx
/image-files/root/.bashrc
View file @
9d9498ad
File moved
php
/image-files/usr/local/bin/composer
→
nginx
/image-files/usr/local/bin/composer
View file @
9d9498ad
File moved
php
/image-files/usr/local/bin/docker-entrypoint.sh
→
nginx
/image-files/usr/local/bin/docker-entrypoint.sh
View file @
9d9498ad
File moved
php
/image-files/usr/local/bin/docker-run.sh
→
nginx
/image-files/usr/local/bin/docker-run.sh
View file @
9d9498ad
File moved
php
/image-files/usr/local/etc/php/conf.d/base.ini
→
nginx
/image-files/usr/local/etc/php/conf.d/base.ini
View file @
9d9498ad
File moved
php
/image-files/usr/local/etc/php/php-fpm.conf
→
nginx
/image-files/usr/local/etc/php/php-fpm.conf
View file @
9d9498ad
File moved
php
/image-files/usr/local/etc/php/pool.d/www.conf
→
nginx
/image-files/usr/local/etc/php/pool.d/www.conf
View file @
9d9498ad
File moved
php/Dockerfile-fpm
deleted
100755 → 0
View file @
8d3d5286
# 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"]
test/debug.sh
View file @
9d9498ad
#!/usr/bin/env bash
PHP_SERVICE
=
${
PHP_SERVICE
-php
}
PHP_SERVICE
=
${
PHP_SERVICE
-php
-nginx
}
echo
"Running one-off command with xdebug"
PHP_ENABLE_XDEBUG
=
1 docker-compose run
${
PHP_SERVICE
}
php
-i
|
grep
xdebug
...
...
test/dev.sh
View file @
9d9498ad
#!/usr/bin/env bash
PHP_SERVICE
=
${
PHP_SERVICE
-php
}
PHP_SERVICE
=
${
PHP_SERVICE
-php
-nginx
}
echo
"Checking composer..."
docker-compose run
--rm
${
PHP_SERVICE
}
composer
--version
||
exit
1
...
...
@@ -14,4 +14,4 @@ docker-compose run --rm ${PHP_SERVICE} git --version || exit 1
echo
"Checking npm..."
docker-compose run
--rm
${
PHP_SERVICE
}
npm
--version
||
exit
1
echo
"Done."
\ No newline at end of file
echo
"Done."
test/prod.sh
View file @
9d9498ad
#!/usr/bin/env bash
PHP_SERVICE
=
${
PHP_SERVICE
-php
}
PHP_SERVICE
=
${
PHP_SERVICE
-php
-nginx
}
docker-compose run
--rm
${
PHP_SERVICE
}
php
--version
# this would match even if module is not loaded, eg. when commented out in opcache.ini
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment