Skip to content

Commit

Permalink
Merge pull request #38 from spaceonfire/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tntrex authored Aug 24, 2020
2 parents 12687f1 + fec73f2 commit eac33bb
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Project files
build.sh

# Numerous always-ignore extensions
*.diff
*.err
Expand Down
32 changes: 25 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ stages:
- latest

variables:
PHP_7_2: 7.2.29
PHP_7_3: 7.3.16
PHP_7_4: 7.4.4
PHP_7_2: 7.2.33
PHP_7_3: 7.3.21
PHP_7_4: 7.4.9
PHP_8_0: 8.0-rc

.build: &build
.build:
stage: build
tags:
- docker
Expand All @@ -17,9 +18,12 @@ variables:
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull "$CACHE_FROM" || true
- docker build -t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" --cache-from "$CACHE_FROM" --build-arg PHP_BASEIMAGE_VERSION=$PHP_BASEIMAGE_VERSION .
- docker push "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG"
- wget https://github.com/hairyhenderson/gomplate/releases/download/v3.7.0/gomplate_linux-amd64-slim -O /usr/local/bin/gomplate
- chmod +x /usr/local/bin/gomplate
- gomplate -f build.sh.tmpl -o build.sh
- sh build.sh
after_script:
- cat build.sh

# PHP 7.2
# =========================================
Expand Down Expand Up @@ -111,6 +115,20 @@ build-tags-7-4:
only:
- tags

# PHP 8.0
# =========================================

build-next-8-0:
extends: .build
variables:
DOCKER_IMAGE_TAG: next-8.0-rc
PHP_BASEIMAGE_VERSION: $PHP_8_0
XDEBUG_VERSION: master
PHP_EXTENSIONS: "dom exif gd iconv intl mysqli opcache pdo pdo soap xsl zip"
CACHE_FROM: $CI_REGISTRY_IMAGE:next-8.0-rc
only:
- next

# Latest
# =========================================

Expand Down
39 changes: 17 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_BASEIMAGE_VERSION=7.4.4
ARG PHP_BASEIMAGE_VERSION=7.4.9
FROM php:${PHP_BASEIMAGE_VERSION}-fpm-alpine

LABEL maintainer="Constantine Karnaukhov <genteelknight@gmail.com>"
Expand All @@ -10,9 +10,15 @@ ENV \
# Fix for iconv: https://github.com/docker-library/php/issues/240
LD_PRELOAD="/usr/lib/preloadable_libiconv.so php"

ARG XDEBUG_VERSION=2.9.6
ARG PHP_EXTENSIONS="dom exif gd iconv intl json mysqli opcache pdo pdo soap xsl zip"

# Install dependencies
RUN echo @testing http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --no-cache \
RUN { \
echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/main"; \
echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community"; \
} >> /etc/apk/repositories && \
apk add --update \
acl \
apk-cron \
augeas-dev \
Expand Down Expand Up @@ -40,13 +46,14 @@ RUN echo @testing http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/re
make \
musl-dev \
mysql-client \
nginx \
nginx@edge \
openssh-client \
ssmtp \
sqlite-dev \
supervisor \
su-exec \
wget \
gnu-libiconv@community \
&& \
docker-php-ext-configure gd \
--with-gd \
Expand All @@ -56,31 +63,19 @@ RUN echo @testing http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/re
--enable-option-checking \
--with-freetype \
--with-jpeg && \
docker-php-ext-install \
dom \
exif \
gd \
iconv \
intl \
json \
mysqli \
opcache \
pdo_mysql \
pdo_sqlite \
soap \
xsl \
zip \
&& \
pecl install xdebug-2.8.1 && \
docker-php-ext-install $PHP_EXTENSIONS && \
git clone -b $XDEBUG_VERSION https://github.com/xdebug/xdebug.git /tmp/xdebug && \
cd /tmp/xdebug && phpize && ./configure --enable-xdebug && make && make install && cd - && \
rm -rf /tmp/xdebug && \
docker-php-source delete && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev make autoconf && \
rm -rf /var/cache/apk/* && \
mkdir -p $COMPOSER_HOME && \
EXPECTED_COMPOSER_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '${EXPECTED_COMPOSER_SIGNATURE}') { echo 'Composer.phar Installer verified'; } else { echo 'Composer.phar Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --install-dir=/usr/bin --filename=composer && \
php -r "unlink('composer-setup.php');" && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev make autoconf && \
apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv && \
composer global require hirak/prestissimo

# tweak php-fpm config
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ Docker образ, основанный на Alpine Linux, с установле

### Версии ПО в образе

| Docker Tag | PHP Version |
| -------------------- | ----------- |
| latest-7.4/2.2.0-7.4 | 7.4.0 |
| latest-7.3/2.2.0-7.3 | 7.3.12 |
| latest-7.2/2.2.0-7.2 | 7.2.25 |
| Docker Tag | PHP Version |
| ------------------------------------- | ----------- |
| `latest` / `latest-7.4` / `2.4.0-7.4` | 7.4.9 |
| `latest-7.3` / `2.4.0-7.3` | 7.3.21 |
| `latest-7.2` / `2.4.0-7.2` | 7.2.33 |
| `next-8.0-rc` | 8.0.0-rc |

## Быстрый старт

Expand Down Expand Up @@ -64,6 +65,5 @@ docker run -d -v `pwd`:/var/www/html -p 8080:8080 spaceonfire/nginx-php-fpm:late
[ico-pipeline-status]: https://gitlab.com/spaceonfire/open-source/nginx-php-fpm/badges/master/pipeline.svg
[ico-version]: https://img.shields.io/github/v/tag/spaceonfire/docker-nginx-php-fpm?sort=semver
[ico-license]: https://img.shields.io/github/license/spaceonfire/docker-nginx-php-fpm

[link-gitlab-pipelines]: https://gitlab.com/spaceonfire/open-source/nginx-php-fpm/pipelines
[link-docker-hub]: https://hub.docker.com/r/spaceonfire/nginx-php-fpm
19 changes: 19 additions & 0 deletions build.sh.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
set -e

{{ $cacheFrom := env.Getenv "CACHE_FROM" -}}
{{ $buildScript := env.ExpandEnv "docker build -t $CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" -}}

{{- range $_, $envName := slice "PHP_BASEIMAGE_VERSION" "XDEBUG_VERSION" "PHP_EXTENSIONS" -}}
{{- $envValue := env.Getenv $envName -}}
{{- if ne $envValue "" -}}
{{- $buildScript = (printf "%s --build-arg %s=\"%s\"" $buildScript $envName $envValue) -}}
{{- end -}}
{{- end -}}

{{ if ne $cacheFrom "" }}
{{- $buildScript = (printf "%s --cache-from %s" $buildScript $cacheFrom) -}}
{{- printf "docker pull %s || true" $cacheFrom -}}
{{ end }}
{{ printf "%s ." $buildScript }}
{{ env.ExpandEnv "docker push $CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" -}}
3 changes: 3 additions & 0 deletions spaceonfire/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ if [ ! -z "$PUID" ]; then
deluser nginx
addgroup -g ${PGID} nginx
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx -u ${PUID} nginx
# Fix permissions on nginx library dir. See #37
chown nginx.nginx /var/lib/nginx
chown -R nginx.nginx /var/lib/nginx/tmp
fi

# Setup access rights for nginx group
Expand Down
18 changes: 18 additions & 0 deletions test/php8/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

services:
test:
build:
context: ../../
args:
PHP_BASEIMAGE_VERSION: 8.0-rc
XDEBUG_VERSION: master
PHP_EXTENSIONS: "dom exif gd iconv intl mysqli opcache pdo pdo soap xsl zip"
image: spaceonfire/nginx-php-fpm:next-8.0.0
entrypoint:
- /bin/bash
tty: true
ports:
- 8080:8080
environment:
- PAGER=more

0 comments on commit eac33bb

Please sign in to comment.