php 8.0, dockerfile refactor
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Aleksander Cynarski 2021-07-02 16:09:52 +02:00
parent b139a868e5
commit 6928a5ecc5
3 changed files with 122 additions and 68 deletions

View File

@ -2,6 +2,43 @@ kind: pipeline
name: default
steps:
- name: php8.0
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: hub_username
password:
from_secret: hub_password
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=8.0-fpm-alpine
tags: 8.0-alpine
when:
branch:
- master
depends_on: [ clone ]
- name: php8.0-dev
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: hub_username
password:
from_secret: hub_password
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=8.0-fpm-alpine
- ENVIRONMENT=development
tags: 8.0-alpine-dev
when:
branch:
- master
depends_on: [ clone ]
- name: php7.4
image: plugins/docker
pull: if-not-exists
@ -13,7 +50,7 @@ steps:
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=7.4-fpm-alpine3.13
- PHP_VERSION=7.4-fpm-alpine
tags: 7.4-alpine
when:
branch:
@ -31,7 +68,7 @@ steps:
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=7.4-fpm-alpine3.13
- PHP_VERSION=7.4-fpm-alpine
- ENVIRONMENT=development
tags: 7.4-alpine-dev
when:
@ -50,31 +87,13 @@ steps:
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=7.3-fpm-alpine3.12
- PHP_VERSION=7.3-fpm-alpine
tags: 7.3-alpine
when:
branch:
- master
depends_on: [ clone ]
- name: php7.2
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: hub_username
password:
from_secret: hub_password
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=7.2-fpm-alpine3.12
tags: 7.2-alpine
when:
branch:
- master
depends_on: [ clone ]
- name: php7.3-dev
image: plugins/docker
pull: if-not-exists
@ -86,10 +105,28 @@ steps:
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=7.3-fpm-alpine3.12
- PHP_VERSION=7.3-fpm-alpine
- ENVIRONMENT=development
tags: 7.3-alpine-dev
when:
branch:
- master
depends_on: [ clone ]
- name: php7.2
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: hub_username
password:
from_secret: hub_password
repo:
from_secret: hub_repo
build_args:
- PHP_VERSION=7.2-fpm-alpine
tags: 7.2-alpine
when:
branch:
- master
depends_on: [ clone ]

View File

@ -8,7 +8,10 @@ FROM paramah/base:alpine as base-config
#==================================================
FROM php:${PHP_VERSION} as builder
RUN apk add --no-cache wget \
RUN apk add --no-cache --virtual build-essentials \
icu-dev icu-libs zlib-dev g++ make automake autoconf libzip-dev \
libpng-dev libwebp-dev libjpeg-turbo-dev freetype-dev \
wget \
curl \
bash \
git \
@ -33,39 +36,9 @@ RUN apk add --no-cache wget \
COPY docker/ /
# Configure php extensions
# Configure & install php extensions
RUN /usr/local/bin/php_configure.sh
# Install php extensions
RUN docker-php-ext-install -j$(nproc) \
calendar \
bcmath \
bz2 \
curl \
fileinfo \
gd \
gettext \
iconv \
imap \
intl \
json \
ldap \
mbstring \
opcache \
pcntl \
pdo \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
pgsql \
phar \
session \
simplexml \
soap \
xml \
zip
#
# Final image
#
@ -74,13 +47,14 @@ FROM php:${PHP_VERSION}
ARG ENVIRONMENT=production
# Add testing alpine repository
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
apk update
# RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86" >> /etc/apk/repositories \
# apk update
# install system libs
RUN apk add --no-cache libintl c-client libpng icu-libs libldap libpq libjpeg freetype libzip shadow sudo fluent-bit td-agent-bit
RUN apk add --no-cache libintl c-client libpng icu-libs libldap libpq libjpeg freetype libzip shadow sudo
# fluent-bit td-agent-bit
# Install apps
# Install appstall PHP modules"
RUN apk add --no-cache wget curl bash git openssh supervisor nginx openssl zip

View File

@ -1,13 +1,56 @@
#!/bin/sh
#!/bin/bash
PHP_VERSION=`php -r 'echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;'`
PHP_MODULES=("calendar" "bcmath" "bz2" "curl" "fileinfo" "gd" "gettext" "iconv" "imap" "intl" "ldap" "mbstring" "opcache" "pcntl" "pdo" "pdo_mysql" "pdo_pgsql" "pdo_sqlite" "pgsql" "phar" "session" "simplexml" "soap" "xml")
if [ $PHP_VERSION = '74' ]; then
docker-php-ext-configure gd --with-freetype --with-jpeg
else
docker-php-ext-configure gd \
--with-freetype-dir=/usr/lib/ \
--with-png-dir=/usr/lib/ \
--with-jpeg-dir=/usr/lib/ \
--with-gd
fi
#
# Helper functions
#
declare -i term_width=120
h1() {
declare border padding text
border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m'
padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))"
text="\\e[1m$*\\e[0m"
echo -e "$border"
echo -e "${padding}${text}${padding}"
echo -e "$border"
}
h2() {
printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*"
}
h1 "Configure PHP modules"
case $PHP_VERSION in
'80' )
h2 "Configure GD"
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
;;
'74' )
h2 "Configure GD"
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
h2 "Install json module"
docker-php-ext-install -j$(nproc) json
;;
* )
h2 "Configure GD"
docker-php-ext-configure gd \
--with-freetype-dir=/usr/lib/ \
--with-png-dir=/usr/lib/ \
--with-jpeg-dir=/usr/lib/ \
--with-gd
h2 "Install json module"
docker-php-ext-install -j$(nproc) json
break
esac
h1 "Install PHP modules"
for module in "${PHP_MODULES[@]}"
do
h1 "Install module: ${module}"
docker-php-ext-install -j$(nproc) $module
done