Commit ca1da426 authored by David Danier's avatar David Danier

initial version

parents
/*.sh
/php.ini
FROM php:5.6-fpm-stretch
# Add php.ini for more dev-specific PHP configuration
COPY php.ini /usr/local/etc/php/
# Add composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install xdebug
# Current version is 2.6.*, but this does not support PHP 5.* any more, so we
# are using an older version.
RUN apt-get update && \
apt-get install -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
pecl install xdebug-2.5.5 && \
rm -rf /var/lib/apt/lists/*
# TODO: Remove packages again, currently apt will bail out with:
# "WARNING: The following essential packages will be removed.
# This should NOT be done unless you know exactly what you are doing!"
#apt-get remove -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
COPY team23-docker-php-enable-xdebug.sh /usr/local/bin/
# Enable our own entrypoint which can be used to enable xdebug using env variables
COPY team23-docker-php-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["team23-docker-php-entrypoint.sh"]
# This has to be here again as ENTRYPOINT seems to reset CMD
CMD ["php-fpm"]
# Finally switch to our standard workdir
WORKDIR /app/web/
/*.sh
/php.ini
FROM php:7.0-fpm-stretch
# Add php.ini for more dev-specific PHP configuration
COPY php.ini /usr/local/etc/php/
# Add composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install xdebug
RUN apt-get update && \
apt-get install -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
pecl install xdebug && \
rm -rf /var/lib/apt/lists/*
# TODO: Remove packages again, currently apt will bail out with:
# "WARNING: The following essential packages will be removed.
# This should NOT be done unless you know exactly what you are doing!"
#apt-get remove -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
COPY team23-docker-php-enable-xdebug.sh /usr/local/bin/
# Enable our own entrypoint which can be used to install/enable xdebug using env variables
COPY team23-docker-php-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["team23-docker-php-entrypoint.sh"]
# This has to be here again as ENTRYPOINT seems to reset CMD
CMD ["php-fpm"]
# Finally switch to our standard workdir
WORKDIR /app/web/
/*.sh
/php.ini
FROM php:7.1-fpm-stretch
# Add php.ini for more dev-specific PHP configuration
COPY php.ini /usr/local/etc/php/
# Add composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install xdebug
RUN apt-get update && \
apt-get install -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
pecl install xdebug && \
rm -rf /var/lib/apt/lists/*
# TODO: Remove packages again, currently apt will bail out with:
# "WARNING: The following essential packages will be removed.
# This should NOT be done unless you know exactly what you are doing!"
#apt-get remove -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
COPY team23-docker-php-enable-xdebug.sh /usr/local/bin/
# Enable our own entrypoint which can be used to install/enable xdebug using env variables
COPY team23-docker-php-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["team23-docker-php-entrypoint.sh"]
# This has to be here again as ENTRYPOINT seems to reset CMD
CMD ["php-fpm"]
# Finally switch to our standard workdir
WORKDIR /app/web/
/*.sh
/php.ini
FROM php:7.2-fpm-alpine3.7
# Add php.ini for more dev-specific PHP configuration
COPY php.ini /usr/local/etc/php/
# Add composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install xdebug
RUN apt-get update && \
apt-get install -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
pecl install xdebug && \
rm -rf /var/lib/apt/lists/*
# TODO: Remove packages again, currently apt will bail out with:
# "WARNING: The following essential packages will be removed.
# This should NOT be done unless you know exactly what you are doing!"
#apt-get remove -y autoconf dpkg dpkg-dev file g++ gcc make pkgconf re2c && \
COPY team23-docker-php-enable-xdebug.sh /usr/local/bin/
# Enable our own entrypoint which can be used to install/enable xdebug using env variables
COPY team23-docker-php-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["team23-docker-php-entrypoint.sh"]
# This has to be here again as ENTRYPOINT seems to reset CMD
CMD ["php-fpm"]
# Finally switch to our standard workdir
WORKDIR /app/web/
# Supported tags and respective Dockerfile links
* `5.6`: [Dockerfile](5.6/Dockerfile)
* `7.0`: [Dockerfile](7.0/Dockerfile)
* `7.1`: [Dockerfile](7.1/Dockerfile)
* `7.2`: [Dockerfile](7.2/Dockerfile)
* `latest`: see `7.2`
# Quick reference
The images base on the official php(-fpm) images from docker. See [docker hub](https://hub.docker.com/_/php/)
for the official details. We use only the debian (stretch) versions.
The following changes were made:
* Increased many of the default limits (execution time, upload size, …)
* Enabled logging on stderr, so errors are visible in the docker logs
* Installed composer (from [composer:latest](https://hub.docker.com/_/composer/))
See our [apache images](https://git.team23.de/docker/apache) ("php") for usage example.
# Debugging using xdebug
xdebug in installed by default, but not enabled. A script `team23-docker-php-enable-xdebug.sh` is provided to
enable xdebug. It is then configured this way:
```ini
xdebug.remote_port=9000
xdebug.remote_enable=1
xdebug.remote_connect_back=1
```
This allows for remote xdebug connections.
Example Dockerfile to enable xdebug:
```dockerfile
FROM docker.team23.de/docker/php-minimal:X.Y
RUN team23-docker-php-enable-xdebug.sh
```
### Alternatively enable xdebug using environment variables
docker-compose.yml:
```yaml
version: "3.0"
services:
php:
image: docker.team23.de/docker/php-minimal:X.Y
environment:
TEAM23_DOCKER_PHP_ENABLE_XDEBUG: 1
```
Of just start the container using `docker … -e TEAM23_DOCKER_PHP_ENABLE_XDEBUG=1 …` in your shell.
#!/bin/bash
# Configuration
VERSIONS="5.6 7.0 7.1 7.2"
LATEST_VERSION="7.2"
# Let's do it
set -o errexit
set -o pipefail
if [ -z "$CI_REGISTRY" ]
then # outside gitlab ci runner
docker login docker.team23.de
BUILD_PROJECT_NAME=$( basename $( pwd ) )
BUILD_IMAGE_BASE="docker.team23.de/docker/$BUILD_PROJECT_NAME"
else # inside gitlab ci runner
docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
BUILD_IMAGE_BASE="$CI_REGISTRY/$CI_PROJECT_PATH"
fi
for VERSION in $VERSIONS
do
# Copy shared files
cp -rp shared/*.sh "$VERSION/"
cp -rp shared/php.ini "$VERSION/"
# Copy version specific versions of shared scripts
if [ -d shared/$VERSION ]
then
cp -rp shared/$VERSION/*.sh "$VERSION/"
fi
# Build Image
docker build --pull -t "$BUILD_IMAGE_BASE:$VERSION" "$VERSION"
docker push "$BUILD_IMAGE_BASE:$VERSION"
done
# Build latest image
docker build --pull -t "$BUILD_IMAGE_BASE:latest" "$LATEST_VERSION"
docker push "$BUILD_IMAGE_BASE:latest"
[PHP]
max_execution_time = 240
max_input_vars = 1500
upload_max_filesize = 32M
post_max_size=32M
always_populate_raw_post_data=-1
; show errors in docker log
log_errors = On
error_log = /dev/stderr
#!/bin/sh
set -o errexit
set -o pipefail
docker-php-ext-enable xdebug
echo -e "xdebug.remote_port=9000\nxdebug.remote_enable=1\nxdebug.remote_connect_back=1" > /usr/local/etc/php/conf.d/xdebug_remote.ini
#!/bin/sh
set -e
[ ! -z "${TEAM23_DOCKER_PHP_ENABLE_XDEBUG:-}" ] && /usr/local/bin/team23-docker-php-enable-xdebug.sh
exec docker-php-entrypoint "$@"
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