Skip to content

Commit 16241c9

Browse files
authored
Merge pull request #46 from spaceonfire/develop
feat: massive updates
2 parents 64dc9b0 + bba4f8f commit 16241c9

File tree

10 files changed

+122
-59
lines changed

10 files changed

+122
-59
lines changed

.gitlab-ci.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ stages:
33
- latest
44

55
variables:
6-
PHP_7_2: 7.2.33
7-
PHP_7_3: 7.3.22
8-
PHP_7_4: 7.4.10
9-
PHP_8_0: 8.0-rc
6+
PHP_8_0: 8.0.2
7+
PHP_7_4: 7.4.15
8+
PHP_7_3: 7.3.27
9+
PHP_7_2: 7.2.34
1010

1111
.build:
1212
stage: build
@@ -34,6 +34,7 @@ build-next-7-2:
3434
DOCKER_IMAGE_TAG: next-7.2
3535
PHP_BASEIMAGE_VERSION: $PHP_7_2
3636
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.2
37+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
3738
only:
3839
- next
3940

@@ -43,6 +44,7 @@ build-master-7-2:
4344
DOCKER_IMAGE_TAG: latest-7.2
4445
PHP_BASEIMAGE_VERSION: $PHP_7_2
4546
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.2
47+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
4648
only:
4749
- master
4850

@@ -52,6 +54,7 @@ build-tags-7-2:
5254
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME-7.2
5355
PHP_BASEIMAGE_VERSION: $PHP_7_2
5456
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.2
57+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
5558
only:
5659
- tags
5760

@@ -64,6 +67,7 @@ build-next-7-3:
6467
DOCKER_IMAGE_TAG: next-7.3
6568
PHP_BASEIMAGE_VERSION: $PHP_7_3
6669
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.3
70+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
6771
only:
6872
- next
6973

@@ -73,6 +77,7 @@ build-master-7-3:
7377
DOCKER_IMAGE_TAG: latest-7.3
7478
PHP_BASEIMAGE_VERSION: $PHP_7_3
7579
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.3
80+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
7681
only:
7782
- master
7883

@@ -82,6 +87,7 @@ build-tags-7-3:
8287
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME-7.3
8388
PHP_BASEIMAGE_VERSION: $PHP_7_3
8489
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.3
90+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
8591
only:
8692
- tags
8793

@@ -94,6 +100,7 @@ build-next-7-4:
94100
DOCKER_IMAGE_TAG: next-7.4
95101
PHP_BASEIMAGE_VERSION: $PHP_7_4
96102
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.4
103+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
97104
only:
98105
- next
99106

@@ -103,6 +110,7 @@ build-master-7-4:
103110
DOCKER_IMAGE_TAG: latest-7.4
104111
PHP_BASEIMAGE_VERSION: $PHP_7_4
105112
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.4
113+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
106114
only:
107115
- master
108116

@@ -112,6 +120,7 @@ build-tags-7-4:
112120
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME-7.4
113121
PHP_BASEIMAGE_VERSION: $PHP_7_4
114122
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.4
123+
PHP_EXTENSIONS: "dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
115124
only:
116125
- tags
117126

@@ -121,14 +130,31 @@ build-tags-7-4:
121130
build-next-8-0:
122131
extends: .build
123132
variables:
124-
DOCKER_IMAGE_TAG: next-8.0-rc
133+
DOCKER_IMAGE_TAG: next-8.0
125134
PHP_BASEIMAGE_VERSION: $PHP_8_0
126135
XDEBUG_VERSION: master
127-
PHP_EXTENSIONS: "dom exif gd iconv intl mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
128-
CACHE_FROM: $CI_REGISTRY_IMAGE:next-8.0-rc
136+
CACHE_FROM: $CI_REGISTRY_IMAGE:next-8.0
129137
only:
130138
- next
131139

140+
build-master-8-0:
141+
extends: .build
142+
variables:
143+
DOCKER_IMAGE_TAG: latest-8.0
144+
PHP_BASEIMAGE_VERSION: $PHP_8_0
145+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-8.0
146+
only:
147+
- master
148+
149+
build-tags-8-0:
150+
extends: .build
151+
variables:
152+
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME-8.0
153+
PHP_BASEIMAGE_VERSION: $PHP_8_0
154+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-8.0
155+
only:
156+
- tags
157+
132158
# Latest
133159
# =========================================
134160

@@ -137,8 +163,8 @@ build-next-latest:
137163
stage: latest
138164
variables:
139165
DOCKER_IMAGE_TAG: next
140-
PHP_BASEIMAGE_VERSION: $PHP_7_4
141-
CACHE_FROM: $CI_REGISTRY_IMAGE:next-7.4
166+
PHP_BASEIMAGE_VERSION: $PHP_8_0
167+
CACHE_FROM: $CI_REGISTRY_IMAGE:next-8.0
142168
only:
143169
- next
144170

@@ -147,8 +173,8 @@ build-master-latest:
147173
stage: latest
148174
variables:
149175
DOCKER_IMAGE_TAG: latest
150-
PHP_BASEIMAGE_VERSION: $PHP_7_4
151-
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.4
176+
PHP_BASEIMAGE_VERSION: $PHP_8_0
177+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-8.0
152178
only:
153179
- master
154180

@@ -157,7 +183,7 @@ build-tags-latest:
157183
stage: latest
158184
variables:
159185
DOCKER_IMAGE_TAG: $CI_COMMIT_REF_NAME
160-
PHP_BASEIMAGE_VERSION: $PHP_7_4
161-
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-7.4
186+
PHP_BASEIMAGE_VERSION: $PHP_8_0
187+
CACHE_FROM: $CI_REGISTRY_IMAGE:latest-8.0
162188
only:
163189
- tags

Dockerfile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_BASEIMAGE_VERSION=7.4.10
1+
ARG PHP_BASEIMAGE_VERSION=8.0.2
22
FROM php:${PHP_BASEIMAGE_VERSION}-fpm-alpine
33

44
LABEL maintainer="Constantine Karnaukhov <[email protected]>"
@@ -10,8 +10,8 @@ ENV \
1010
# Fix for iconv: https://github.com/docker-library/php/issues/240
1111
LD_PRELOAD="/usr/lib/preloadable_libiconv.so php"
1212

13-
ARG XDEBUG_VERSION=2.9.8
14-
ARG PHP_EXTENSIONS="dom exif gd iconv intl json mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
13+
ARG XDEBUG_VERSION=3.0.2
14+
ARG PHP_EXTENSIONS="dom exif gd iconv intl mysqli opcache pdo_mysql pdo_sqlite soap xsl zip"
1515

1616
# Install dependencies
1717
RUN apk add --update \
@@ -65,14 +65,7 @@ RUN apk add --update \
6565
rm -rf /tmp/xdebug && \
6666
docker-php-source delete && \
6767
apk del gcc musl-dev linux-headers libffi-dev augeas-dev make autoconf && \
68-
rm -rf /var/cache/apk/* && \
69-
mkdir -p $COMPOSER_HOME && \
70-
EXPECTED_COMPOSER_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) && \
71-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
72-
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;" && \
73-
php composer-setup.php --install-dir=/usr/bin --filename=composer && \
74-
php -r "unlink('composer-setup.php');" && \
75-
composer global require hirak/prestissimo
68+
rm -rf /var/cache/apk/*
7669

7770
# tweak php-fpm config
7871
RUN echo "" > /usr/local/etc/php/conf.d/05-php.ini && \
@@ -116,6 +109,7 @@ RUN mkdir -p /etc/nginx && \
116109
ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
117110

118111
# Add spaceonfire
112+
ENV PATH="${PATH}:${COMPOSER_HOME}/bin:${COMPOSER_HOME}/vendor/bin"
119113
COPY ./spaceonfire/ /opt/spaceonfire/
120114
RUN chmod -R +x /opt/spaceonfire/bin/* && /opt/spaceonfire/bin/install.sh
121115

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Docker образ, основанный на Alpine Linux, с установле
2121

2222
| Docker Tag | PHP Version |
2323
| ------------------------------------- | ----------- |
24-
| `latest` / `latest-7.4` / `2.4.2-7.4` | 7.4.10 |
25-
| `latest-7.3` / `2.4.2-7.3` | 7.3.22 |
26-
| `latest-7.2` / `2.4.2-7.2` | 7.2.33 |
27-
| `next-8.0-rc` | 8.0.0-rc |
24+
| `latest` / `latest-8.0` / `2.5.0-8.0` | 8.0.2 |
25+
| `latest-7.4` / `2.5.0-7.4` | 7.4.15 |
26+
| `latest-7.3` / `2.5.0-7.3` | 7.3.27 |
27+
| `latest-7.2` / `2.5.0-7.2` | 7.2.34 |
2828

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

docs/configure.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
| `DOMAIN` | Укажите свой домен, чтобы добавить настройку RewriteDomain в конфиг ssmtp |
2929
| `SSMTP_DEFAULT_FROM` | Укажите email, с которого должная отправляться почта по-умолчанию |
3030
| `ENABLE_XDEBUG` | Укажите "1", включить расширение Xdebug |
31-
| `XDEBUG_REMOTE_HOST` | Укажите свой IP адрес для `xdebug.remote_host`. [Подробнее про Xdebug](./xdebug.md) |
31+
| `XDEBUG_REMOTE_HOST` | Укажите свой IP адрес для `xdebug.client_host`. [Подробнее про Xdebug](./xdebug.md) |
3232
| `XDEBUG_IDEKEY` | Укажите свой IDE key для `xdebug.idekey`. [Подробнее про Xdebug](./xdebug.md) |
33+
| `COMPOSER_VERSION` | Выберите мажорную версию Composer (`v1` или `v2`, по-умолчанию `v1`) |

spaceonfire/bin/entrypoint.sh

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/bash
22

33
# Set custom webroot
4-
if [ ! -z "$WEBROOT" ]; then
4+
if [ -n "$WEBROOT" ]; then
55
sed -i "s#root /var/www/html;#root ${WEBROOT};#g" /etc/nginx/sites-available/default.conf
66
else
77
WEBROOT=/var/www/html
88
fi
99

1010
# Recreate nginx user with passed UID and GID
11-
if [ ! -z "$PUID" ]; then
11+
if [ -n "$PUID" ]; then
1212
if [ -z "$PGID" ]; then
1313
PGID=${PUID}
1414
fi
@@ -21,34 +21,46 @@ if [ ! -z "$PUID" ]; then
2121
fi
2222

2323
# Setup access rights for nginx group
24-
setfacl -RL -m g:nginx:rwx $COMPOSER_HOME >> /dev/null 2>&1
24+
{
25+
setfacl -RLm g:nginx:rwx "$COMPOSER_HOME"
26+
setfacl -RLdm g:nginx:rwx "$COMPOSER_HOME"
27+
setfacl -RLm g:nginx:rwx /opt/spaceonfire/composer/v1
28+
setfacl -RLdm g:nginx:rwx /opt/spaceonfire/composer/v1
29+
setfacl -RLm g:nginx:rwx /opt/spaceonfire/composer/v2
30+
setfacl -RLdm g:nginx:rwx /opt/spaceonfire/composer/v2
31+
} >>/dev/null 2>&1
32+
2533
if [[ "$SKIP_SETFACL" != "1" ]]; then
26-
setfacl -RL -m g:nginx:rwx /var/www/html/ >> /dev/null 2>&1
34+
setfacl -RLdm g:nginx:rwx /var/www/html/ >>/dev/null 2>&1
2735
fi
2836

2937
# Copy default index.html
3038
if [ $(ls $WEBROOT/index.{php,htm,html} 2>/dev/null | wc -l) -eq 0 ]; then
3139
cp -f /opt/spaceonfire/html/index.html $WEBROOT
3240
fi
3341

34-
if [ ! -z "$SOF_PRESET" ]; then
42+
if [ -n "$SOF_PRESET" ]; then
3543
/opt/spaceonfire/bin/select-preset.sh $SOF_PRESET
3644
fi
3745

46+
if [ -n "$COMPOSER_VERSION" ]; then
47+
/opt/spaceonfire/bin/select-composer.sh $COMPOSER_VERSION
48+
fi
49+
3850
/opt/spaceonfire/bin/ssmtp-setup.php
3951

4052
# Set Nginx read timeout
4153
if [[ -z "$NGINX_READ_TIMEOUT" ]] && [[ "$APPLICATION_ENV" != "production" ]]; then
4254
NGINX_READ_TIMEOUT=9999
4355
fi
4456

45-
if [[ ! -z "$NGINX_READ_TIMEOUT" ]]; then
57+
if [[ -n "$NGINX_READ_TIMEOUT" ]]; then
4658
FastCgiParamsFile="/etc/nginx/fastcgi_params"
4759
if ! grep -q fastcgi_read_timeout "$FastCgiParamsFile"; then
4860
{
4961
echo ""
5062
echo "fastcgi_read_timeout $NGINX_READ_TIMEOUT;"
51-
} >> $FastCgiParamsFile
63+
} >>$FastCgiParamsFile
5264
fi
5365
fi
5466

@@ -59,21 +71,21 @@ if [[ $lastlinephpconf == *"php_flag[display_errors]"* ]]; then
5971
fi
6072

6173
# Display PHP error's or not
62-
if [[ "$ERRORS" != "1" ]] ; then
63-
echo "php_flag[display_errors] = off" >> /usr/local/etc/php-fpm.conf
74+
if [[ "$ERRORS" != "1" ]]; then
75+
echo "php_flag[display_errors] = off" >>/usr/local/etc/php-fpm.conf
6476
else
65-
echo "php_flag[display_errors] = on" >> /usr/local/etc/php-fpm.conf
77+
echo "php_flag[display_errors] = on" >>/usr/local/etc/php-fpm.conf
6678
fi
6779

6880
# Display Version Details or not
69-
if [[ "$HIDE_NGINX_HEADERS" == "0" ]] ; then
81+
if [[ "$HIDE_NGINX_HEADERS" == "0" ]]; then
7082
sed -i "s/server_tokens off;/server_tokens on;/g" /etc/nginx/nginx.conf
7183
else
7284
sed -i "s/expose_php = On/expose_php = Off/g" /usr/local/etc/php-fpm.conf
7385
fi
7486

7587
# Pass real-ip to logs when behind ELB, etc
76-
if [[ "$REAL_IP_HEADER" == "1" ]] ; then
88+
if [[ "$REAL_IP_HEADER" == "1" ]]; then
7789
vhosts=('/etc/nginx/sites-available/default.conf' '/etc/nginx/sites-available/default-ssl.conf')
7890
for vhost in vhosts; do
7991
sed -i "s/#real_ip_header X-Forwarded-For;/real_ip_header X-Forwarded-For;/" $vhost
@@ -85,30 +97,30 @@ if [[ "$REAL_IP_HEADER" == "1" ]] ; then
8597
fi
8698

8799
#Display errors in docker logs
88-
if [ ! -z "$PHP_ERRORS_STDERR" ]; then
89-
echo "log_errors = On" >> /usr/local/etc/php/conf.d/docker-vars.ini
90-
echo "error_log = /dev/stderr" >> /usr/local/etc/php/conf.d/docker-vars.ini
100+
if [ -n "$PHP_ERRORS_STDERR" ]; then
101+
echo "log_errors = On" >>/usr/local/etc/php/conf.d/docker-vars.ini
102+
echo "error_log = /dev/stderr" >>/usr/local/etc/php/conf.d/docker-vars.ini
91103
fi
92104

93105
# Increase the memory_limit
94-
if [ ! -z "$PHP_MEM_LIMIT" ]; then
106+
if [ -n "$PHP_MEM_LIMIT" ]; then
95107
sed -i "s/memory_limit = 128M/memory_limit = ${PHP_MEM_LIMIT}M/g" /usr/local/etc/php/conf.d/docker-vars.ini
96108
fi
97109

98110
# Increase the post_max_size
99-
if [ ! -z "$PHP_POST_MAX_SIZE" ]; then
111+
if [ -n "$PHP_POST_MAX_SIZE" ]; then
100112
sed -i "s/post_max_size = 100M/post_max_size = ${PHP_POST_MAX_SIZE}M/g" /usr/local/etc/php/conf.d/docker-vars.ini
101113
fi
102114

103115
# Increase the upload_max_filesize
104-
if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then
116+
if [ -n "$PHP_UPLOAD_MAX_FILESIZE" ]; then
105117
sed -i "s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE}M/g" /usr/local/etc/php/conf.d/docker-vars.ini
106118
fi
107119

108120
# Enable xdebug only
109121
if [ "$APPLICATION_ENV" != "production" ]; then
110122
XdebugFile='/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini'
111-
if [[ "$ENABLE_XDEBUG" == "1" ]] ; then
123+
if [[ "$ENABLE_XDEBUG" == "1" ]]; then
112124
if [ -f $XdebugFile ]; then
113125
echo "Xdebug enabled"
114126
else
@@ -120,7 +132,7 @@ if [ "$APPLICATION_ENV" != "production" ]; then
120132
if [ -f $XdebugFile ]; then
121133
# Get default route ip if not set
122134
if [ -z "$XDEBUG_REMOTE_HOST" ]; then
123-
XDEBUG_REMOTE_HOST=$(ip route|awk '/default/ { print $3 }')
135+
XDEBUG_REMOTE_HOST=$(ip route | awk '/default/ { print $3 }')
124136
fi
125137

126138
# See if file contains xdebug text.
@@ -129,15 +141,14 @@ if [ "$APPLICATION_ENV" != "production" ]; then
129141
else
130142
{
131143
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)"
132-
echo "xdebug.remote_enable=1"
133-
echo "xdebug.remote_autostart=1"
134-
echo "xdebug.remote_connect_back=0"
135-
echo "xdebug.remote_host=${XDEBUG_REMOTE_HOST}"
144+
echo "xdebug.mode=debug"
145+
echo "xdebug.start_with_request=1"
136146
echo "xdebug.idekey=${XDEBUG_IDEKEY:-docker}"
147+
echo "xdebug.client_host=${XDEBUG_REMOTE_HOST}"
137148
echo "xdebug.var_display_max_depth=-1"
138149
echo "xdebug.var_display_max_children=-1"
139150
echo "xdebug.var_display_max_data=-1"
140-
} > $XdebugFile
151+
} >$XdebugFile
141152
fi
142153
fi
143154
fi
@@ -150,12 +161,13 @@ if [ "$APPLICATION_ENV" != "production" ]; then
150161
fi
151162

152163
# Run custom scripts
153-
if [[ "$RUN_SCRIPTS" == "1" ]] ; then
164+
if [[ "$RUN_SCRIPTS" == "1" ]]; then
154165
if [ -d "/var/www/html/scripts/" ]; then
155-
# make scripts executable incase they aren't
156-
chmod -Rf 750 /var/www/html/scripts/*; sync;
166+
# make scripts executable in case they aren't
167+
chmod -Rf 750 /var/www/html/scripts/*
168+
sync
157169
# run scripts in number order
158-
for i in /var/www/html/scripts/*; do $i ; done
170+
for i in /var/www/html/scripts/*; do $i; done
159171
else
160172
echo "Can't find script directory"
161173
fi

0 commit comments

Comments
 (0)