Skip to content

Commit bdc191b

Browse files
authored
Merge pull request #20 from dockeronfire/next
Next generation of image
2 parents 06c7fd6 + e16aacd commit bdc191b

22 files changed

+157
-301
lines changed

.gitlab-ci.yml

Lines changed: 94 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,114 @@
1-
image: docker:latest
1+
stages:
2+
- build
3+
- latest
24

3-
services:
4-
- docker:dind
5+
variables:
6+
PHP_7_2: 7.2.21
7+
PHP_7_3: 7.3.8
58

69
.build: &build
710
stage: build
11+
tags:
12+
- docker
13+
image: docker:latest
14+
services:
15+
- docker:dind
816
before_script:
917
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
1018
script:
11-
- docker pull "$CI_REGISTRY_IMAGE:latest"
12-
- docker build -t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" --cache-from "$CI_REGISTRY_IMAGE:latest" .
19+
- docker pull "$CACHE_FROM" || true
20+
- docker build -t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" --cache-from "$CACHE_FROM" --build-arg PHP_BASEIMAGE_VERION=$PHP_BASEIMAGE_VERION .
1321
- docker push "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG"
1422

15-
build-master:
23+
# PHP 7.2
24+
# =========================================
25+
26+
build-next-7-2:
27+
<<: *build
28+
variables:
29+
DOCKER_IMAGE_TAG: next-7.2
30+
PHP_BASEIMAGE_VERION: $PHP_7_2
31+
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.2
32+
only:
33+
- next
34+
35+
build-master-7-2:
36+
<<: *build
37+
variables:
38+
DOCKER_IMAGE_TAG: latest-7.2
39+
PHP_BASEIMAGE_VERION: $PHP_7_2
40+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.2
41+
only:
42+
- master
43+
44+
build-tags-7-2:
45+
<<: *build
46+
variables:
47+
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME-7.2
48+
PHP_BASEIMAGE_VERION: $PHP_7_2
49+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.2
50+
only:
51+
- tags
52+
53+
# PHP 7.3
54+
# =========================================
55+
56+
build-next-7-3:
57+
<<: *build
58+
variables:
59+
DOCKER_IMAGE_TAG: next-7.3
60+
PHP_BASEIMAGE_VERION: $PHP_7_3
61+
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.3
62+
only:
63+
- next
64+
65+
build-master-7-3:
66+
<<: *build
67+
variables:
68+
DOCKER_IMAGE_TAG: latest-7.3
69+
PHP_BASEIMAGE_VERION: $PHP_7_3
70+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.3
71+
only:
72+
- master
73+
74+
build-tags-7-3:
75+
<<: *build
76+
variables:
77+
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME-7.3
78+
PHP_BASEIMAGE_VERION: $PHP_7_3
79+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.3
80+
only:
81+
- tags
82+
83+
# Latest
84+
# =========================================
85+
86+
build-next-latest:
87+
<<: *build
88+
stage: latest
89+
variables:
90+
DOCKER_IMAGE_TAG: next
91+
PHP_BASEIMAGE_VERION: $PHP_7_3
92+
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.3
93+
only:
94+
- next
95+
96+
build-master-latest:
1697
<<: *build
98+
stage: latest
1799
variables:
18100
DOCKER_IMAGE_TAG: latest
101+
PHP_BASEIMAGE_VERION: $PHP_7_3
102+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.3
19103
only:
20104
- master
21105

22-
build-tags:
106+
build-tags-latest:
23107
<<: *build
108+
stage: latest
24109
variables:
25110
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME
111+
PHP_BASEIMAGE_VERION: $PHP_7_3
112+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.3
26113
only:
27114
- tags

Dockerfile

Lines changed: 29 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,31 @@
1-
FROM php:7.2.10-fpm-alpine
1+
ARG PHP_BASEIMAGE_VERION=7.3.6
2+
FROM php:${PHP_BASEIMAGE_VERION}-fpm-alpine
23

34
LABEL maintainer="Constantine Karnaukhov <genteelknight@gmail.com>"
45

5-
# resolves gitlab.com/ric_harvey/nginx-php-fpm#166
6-
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
7-
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv
6+
# Setup some env
7+
ENV \
8+
# Setup same composer home directory for all users
9+
COMPOSER_HOME="/usr/local/composer" \
10+
# Fix for iconv: https://github.com/docker-library/php/issues/240
11+
LD_PRELOAD="/usr/lib/preloadable_libiconv.so php"
812

9-
# Install nginx
10-
RUN NGINX_VERSION=1.14.0 \
11-
&& LUA_MODULE_VERSION=0.10.13 \
12-
&& DEVEL_KIT_MODULE_VERSION=0.3.0 \
13-
&& GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
14-
&& CONFIG="\
15-
--prefix=/etc/nginx \
16-
--sbin-path=/usr/sbin/nginx \
17-
--modules-path=/usr/lib/nginx/modules \
18-
--conf-path=/etc/nginx/nginx.conf \
19-
--error-log-path=/var/log/nginx/error.log \
20-
--http-log-path=/var/log/nginx/access.log \
21-
--pid-path=/var/run/nginx.pid \
22-
--lock-path=/var/run/nginx.lock \
23-
--http-client-body-temp-path=/var/cache/nginx/client_temp \
24-
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
25-
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
26-
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
27-
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
28-
--user=nginx \
29-
--group=nginx \
30-
--with-http_ssl_module \
31-
--with-http_realip_module \
32-
--with-http_addition_module \
33-
--with-http_sub_module \
34-
--with-http_dav_module \
35-
--with-http_flv_module \
36-
--with-http_mp4_module \
37-
--with-http_gunzip_module \
38-
--with-http_gzip_static_module \
39-
--with-http_random_index_module \
40-
--with-http_secure_link_module \
41-
--with-http_stub_status_module \
42-
--with-http_auth_request_module \
43-
--with-http_xslt_module=dynamic \
44-
--with-http_image_filter_module=dynamic \
45-
--with-http_geoip_module=dynamic \
46-
--with-http_perl_module=dynamic \
47-
--with-threads \
48-
--with-stream \
49-
--with-stream_ssl_module \
50-
--with-stream_ssl_preread_module \
51-
--with-stream_realip_module \
52-
--with-stream_geoip_module=dynamic \
53-
--with-http_slice_module \
54-
--with-mail \
55-
--with-mail_ssl_module \
56-
--with-compat \
57-
--with-file-aio \
58-
--with-http_v2_module \
59-
--add-module=/usr/src/ngx_devel_kit-$DEVEL_KIT_MODULE_VERSION \
60-
--add-module=/usr/src/lua-nginx-module-$LUA_MODULE_VERSION \
61-
" \
62-
&& export LUAJIT_LIB=/usr/lib \
63-
&& export LUAJIT_INC=/usr/include/luajit-2.1 \
64-
&& addgroup -S nginx \
65-
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
66-
&& apk add --no-cache --virtual .build-deps \
67-
autoconf \
68-
gcc \
69-
libc-dev \
70-
make \
71-
libressl-dev \
72-
pcre-dev \
73-
zlib-dev \
74-
linux-headers \
75-
curl \
76-
gnupg \
77-
libxslt-dev \
78-
gd-dev \
79-
geoip-dev \
80-
perl-dev \
81-
luajit-dev \
82-
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
83-
&& curl -fSL http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
84-
&& curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v$DEVEL_KIT_MODULE_VERSION.tar.gz -o ndk.tar.gz \
85-
&& curl -fSL https://github.com/openresty/lua-nginx-module/archive/v$LUA_MODULE_VERSION.tar.gz -o lua.tar.gz \
86-
&& export GNUPGHOME="$(mktemp -d)" \
87-
&& found=''; \
88-
for server in \
89-
ha.pool.sks-keyservers.net \
90-
hkp://keyserver.ubuntu.com:80 \
91-
hkp://p80.pool.sks-keyservers.net:80 \
92-
pgp.mit.edu \
93-
; do \
94-
echo "Fetching GPG key $GPG_KEYS from $server"; \
95-
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \
96-
done; \
97-
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
98-
gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
99-
#&& rm -r "$GNUPGHOME" nginx.tar.gz.asc \
100-
&& mkdir -p /usr/src \
101-
&& tar -zxC /usr/src -f nginx.tar.gz \
102-
&& tar -zxC /usr/src -f ndk.tar.gz \
103-
&& tar -zxC /usr/src -f lua.tar.gz \
104-
&& rm nginx.tar.gz nginx.tar.gz.asc ndk.tar.gz lua.tar.gz \
105-
&& cd /usr/src/nginx-$NGINX_VERSION \
106-
&& ./configure $CONFIG --with-debug \
107-
&& make -j$(getconf _NPROCESSORS_ONLN) \
108-
&& mv objs/nginx objs/nginx-debug \
109-
&& mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
110-
&& mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
111-
&& mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
112-
&& mv objs/ngx_http_perl_module.so objs/ngx_http_perl_module-debug.so \
113-
&& mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
114-
&& ./configure $CONFIG \
115-
&& make -j$(getconf _NPROCESSORS_ONLN) \
116-
&& make install \
117-
&& rm -rf /etc/nginx/html/ \
118-
&& mkdir /etc/nginx/conf.d/ \
119-
&& mkdir -p /usr/share/nginx/html/ \
120-
&& install -m644 html/index.html /usr/share/nginx/html/ \
121-
&& install -m644 html/50x.html /usr/share/nginx/html/ \
122-
&& install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
123-
&& install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
124-
&& install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
125-
&& install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
126-
&& install -m755 objs/ngx_http_perl_module-debug.so /usr/lib/nginx/modules/ngx_http_perl_module-debug.so \
127-
&& install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
128-
&& ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
129-
&& strip /usr/sbin/nginx* \
130-
&& strip /usr/lib/nginx/modules/*.so \
131-
&& rm -rf /usr/src/nginx-$NGINX_VERSION \
132-
\
133-
# Bring in gettext so we can get `envsubst`, then throw
134-
# the rest away. To do this, we need to install `gettext`
135-
# then move `envsubst` out of the way so `gettext` can
136-
# be deleted completely, then move `envsubst` back.
137-
&& apk add --no-cache --virtual .gettext gettext \
138-
&& mv /usr/bin/envsubst /tmp/ \
139-
\
140-
&& runDeps="$( \
141-
scanelf --needed --nobanner /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
142-
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
143-
| sort -u \
144-
| xargs -r apk info --installed \
145-
| sort -u \
146-
)" \
147-
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
148-
&& apk del .build-deps \
149-
&& apk del .gettext \
150-
&& mv /tmp/envsubst /usr/local/bin/ \
151-
\
152-
# forward request and error logs to docker log collector
153-
&& ln -sf /dev/stdout /var/log/nginx/access.log \
154-
&& ln -sf /dev/stderr /var/log/nginx/error.log
155-
156-
# Configure php-fpm
157-
RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
158-
echo /etc/apk/respositories && \
159-
apk update && apk upgrade &&\
13+
# Install dependencies
14+
RUN echo @testing http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
16015
apk add --no-cache \
16+
nginx \
17+
supervisor \
18+
gomplate \
19+
ssmtp \
20+
mysql-client \
21+
apk-cron \
16122
bash \
23+
su-exec \
24+
git \
16225
openssh-client \
16326
wget \
164-
supervisor \
16527
curl \
16628
libcurl \
167-
git \
168-
python \
169-
python-dev \
170-
py-pip \
17129
augeas-dev \
17230
libressl-dev \
17331
ca-certificates \
@@ -186,27 +44,26 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
18644
freetype-dev \
18745
sqlite-dev \
18846
libjpeg-turbo-dev \
189-
ssmtp \
190-
mysql-client \
191-
apk-cron && \
47+
acl \
48+
libzip-dev \
49+
&& \
19250
docker-php-ext-configure gd \
19351
--with-gd \
19452
--with-freetype-dir=/usr/include/ \
19553
--with-png-dir=/usr/include/ \
19654
--with-jpeg-dir=/usr/include/ && \
19755
docker-php-ext-install iconv pdo_mysql pdo_sqlite mysqli gd exif intl xsl json soap dom zip opcache && \
198-
pecl install xdebug-2.6.1 && \
56+
pecl install xdebug-2.7.2 && \
19957
docker-php-source delete && \
58+
mkdir -p $COMPOSER_HOME && \
20059
EXPECTED_COMPOSER_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) && \
20160
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
20261
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;" && \
20362
php composer-setup.php --install-dir=/usr/bin --filename=composer && \
20463
php -r "unlink('composer-setup.php');" && \
205-
composer global require hirak/prestissimo && \
206-
pip install -U pip && \
207-
pip install -U certbot && \
208-
mkdir -p /etc/letsencrypt/webrootauth && \
209-
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev make autoconf
64+
apk del gcc musl-dev linux-headers libffi-dev augeas-dev make autoconf && \
65+
apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv && \
66+
composer global require hirak/prestissimo
21067

21168
# tweak php-fpm config
21269
RUN echo "" > /usr/local/etc/php/conf.d/05-php.ini && \
@@ -233,7 +90,7 @@ RUN echo "" > /usr/local/etc/php/conf.d/05-php.ini && \
23390
-e "s/^;clear_env = no$/clear_env = no/" \
23491
/usr/local/etc/php-fpm.d/www.conf
23592

236-
EXPOSE 80 443
93+
EXPOSE 8080 8443
23794

23895
COPY ./conf/supervisord.conf /etc/
23996

@@ -251,6 +108,6 @@ RUN mkdir -p /etc/nginx && \
251108

252109
# Add spaceonfire
253110
COPY ./spaceonfire/ /opt/spaceonfire/
254-
RUN chmod +x /opt/spaceonfire/init.sh && /opt/spaceonfire/init.sh
111+
RUN chmod -R +x /opt/spaceonfire/bin/* && /opt/spaceonfire/bin/install.sh
255112

256-
CMD ["sof-start"]
113+
CMD ["/opt/spaceonfire/bin/entrypoint.sh"]

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# spaceonfire/nginx-php-fpm
22

3-
`spaceonfire/nginx-php-fpm` - Docker образ, основанный на Alpine Linux, с установленными Nginx и PHP-FPM.
3+
[`spaceonfire/nginx-php-fpm`](https://hub.docker.com/r/spaceonfire/nginx-php-fpm) -
4+
Docker образ, основанный на Alpine Linux, с установленными Nginx и PHP-FPM.
45

56
## Обзор
67

@@ -9,13 +10,14 @@
910
на PHP. Доступны настройки для простых PHP приложений, а также веб-приложений на WordPress, Laravel и 1С-Битрикс.
1011

1112
Если у вас есть улучшения или предложения, пожалуйста,
12-
не стесняйтесь открывать issue илл pull request на странице проекта GitHub.
13+
не стесняйтесь открывать issue или pull request на странице проекта GitHub.
1314

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

16-
| Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version |
17-
| ------------ | ------------- | ------------- | ----------- | -------------- |
18-
| latest/1.3.3 | Master Branch | 1.14.0 | 7.2.10 | 3.7 |
17+
| Docker Tag | Git Release | PHP Version | Alpine Version |
18+
| -------------------- | ------------- | ----------- | -------------- |
19+
| latest-7.3/2.0.0-7.3 | Master Branch | 7.3.8 | 3.10.0 |
20+
| latest-7.2/2.0.0-7.2 | Master Branch | 7.2.21 | 3.10.0 |
1921

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

0 commit comments

Comments
 (0)