Skip to content

Commit 95eec7a

Browse files
authored
Merge pull request #8 from it-at-m/chore-zms-3237-base-image-for-php82-and-php83
chore(ZMS-3237): base image for php82 and php83
2 parents 4d05d58 + 7589800 commit 95eec7a

File tree

3 files changed

+324
-0
lines changed

3 files changed

+324
-0
lines changed

.github/workflows/build-images.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,112 @@ on:
88
- '*'
99

1010
jobs:
11+
php_v8_3:
12+
runs-on: ubuntu-latest
13+
env:
14+
IMAGE: ghcr.io/it-at-m/eappointment-php-base
15+
VERSION: "8.3"
16+
DOCKERFILE: php83/Dockerfile
17+
XDEBUG_VERSION: "xdebug-3.3.0"
18+
COMPOSER_VERSION: "2"
19+
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
21+
permissions:
22+
packages: write
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to GitHub Container Registry
29+
run: echo "${{ env.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
30+
31+
- name: Pull existing image for cache (if any)
32+
run: |
33+
docker pull "${{ env.IMAGE }}:${{ env.VERSION }}-dev" || echo "No preexisting image found"
34+
35+
- name: Build base image
36+
run: |
37+
docker build --pull \
38+
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
39+
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
40+
--target base \
41+
-f "${{ env.DOCKERFILE }}" \
42+
-t "${{ env.IMAGE }}:${{ env.VERSION }}-base" \
43+
.
44+
45+
- name: Build dev image without cache
46+
run: |
47+
docker build --pull --no-cache \
48+
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
49+
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
50+
--target dev \
51+
-f "${{ env.DOCKERFILE }}" \
52+
-t "${{ env.IMAGE }}:${{ env.VERSION }}-dev" \
53+
.
54+
55+
- name: Validate PHP setup
56+
run: docker run --rm -i "${{ env.IMAGE }}:${{ env.VERSION }}-dev" php-fpm -t
57+
58+
- name: Push base image to GHCR
59+
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-base"
60+
61+
- name: Push dev image to GHCR
62+
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-dev"
63+
64+
php_v8_2:
65+
runs-on: ubuntu-latest
66+
env:
67+
IMAGE: ghcr.io/it-at-m/eappointment-php-base
68+
VERSION: "8.2"
69+
DOCKERFILE: php82/Dockerfile
70+
XDEBUG_VERSION: "xdebug-3.2.0"
71+
COMPOSER_VERSION: "2"
72+
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
permissions:
75+
packages: write
76+
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v4
80+
81+
- name: Log in to GitHub Container Registry
82+
run: echo "${{ env.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
83+
84+
- name: Pull existing image for cache (if any)
85+
run: |
86+
docker pull "${{ env.IMAGE }}:${{ env.VERSION }}-dev" || echo "No preexisting image found"
87+
88+
- name: Build base image
89+
run: |
90+
docker build --pull \
91+
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
92+
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
93+
--target base \
94+
-f "${{ env.DOCKERFILE }}" \
95+
-t "${{ env.IMAGE }}:${{ env.VERSION }}-base" \
96+
.
97+
98+
- name: Build dev image without cache
99+
run: |
100+
docker build --pull --no-cache \
101+
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
102+
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
103+
--target dev \
104+
-f "${{ env.DOCKERFILE }}" \
105+
-t "${{ env.IMAGE }}:${{ env.VERSION }}-dev" \
106+
.
107+
108+
- name: Validate PHP setup
109+
run: docker run --rm -i "${{ env.IMAGE }}:${{ env.VERSION }}-dev" php-fpm -t
110+
111+
- name: Push base image to GHCR
112+
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-base"
113+
114+
- name: Push dev image to GHCR
115+
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-dev"
116+
11117
php_v8_1:
12118
runs-on: ubuntu-latest
13119
env:

php82/Dockerfile

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
ARG COMPOSER_VERSION="2"
2+
ARG PHP_VERSION="8.2-fpm-bullseye"
3+
4+
# composer version to make available in built image
5+
FROM composer:${COMPOSER_VERSION} AS composer-image
6+
7+
# php version to actually build
8+
FROM php:${PHP_VERSION} AS base
9+
10+
# bash as default shell should exit on non-zero exit-codes in piped commands
11+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
12+
13+
COPY scripts/docker-apt-clean-install /usr/local/sbin/
14+
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
15+
16+
ENV DEBIAN_FRONTEND=noninteractive
17+
18+
# install software available by default in this image
19+
# hadolint ignore=DL3008,DL3009
20+
RUN docker-apt-clean-install \
21+
calendar \
22+
#coreutils \
23+
#debconf-utils \
24+
#gettext \
25+
git \
26+
wget \
27+
gnupg2 \
28+
#gosu \
29+
libbz2-dev \
30+
#libexif-dev \
31+
libfreetype6-dev \
32+
libjpeg62-turbo-dev \
33+
#libgif-dev \
34+
#libgmp-dev \
35+
libicu-dev \
36+
libjpeg-dev \
37+
libpng-dev \
38+
#libpq-dev \
39+
#libpspell-dev \
40+
#libtidy-dev \
41+
libwebp-dev \
42+
libxml2-dev \
43+
#libxpm-dev \
44+
#libxslt1-dev \
45+
libzip-dev \
46+
locales \
47+
msmtp \
48+
tzdata \
49+
unzip \
50+
zlib1g-dev \
51+
zip \
52+
&& echo "tzdata tzdata/Areas select Europe" | debconf-set-selections \
53+
&& echo "tzdata tzdata/Zones/Europe select Berlin" | debconf-set-selections \
54+
&& rm -f /etc/localtime /etc/timezone \
55+
&& dpkg-reconfigure -f noninteractive tzdata
56+
57+
ENV TZ=Europe/Berlin
58+
59+
# configure and install PHP extensions
60+
RUN docker-php-ext-configure calendar \
61+
&& docker-php-ext-configure gd \
62+
--with-freetype \
63+
--with-jpeg \
64+
--with-webp \
65+
&& docker-php-ext-configure intl \
66+
--enable-intl \
67+
&& docker-php-ext-install -j"$(nproc)" \
68+
bcmath \
69+
bz2 \
70+
calendar \
71+
#exif \
72+
gd \
73+
#gmp \
74+
gettext \
75+
intl \
76+
#mysqli \
77+
opcache \
78+
#pcntl \
79+
pdo_mysql \
80+
#pdo_pgsql \
81+
#pspell \
82+
soap \
83+
#sockets \
84+
#tidy \
85+
#xsl \
86+
zip \
87+
&& rm -rf /usr/src/
88+
89+
FROM base as dev
90+
91+
COPY scripts/ /usr/local/sbin/
92+
93+
# install xdebug – it is not enabled by default though, you need to add the following line to your php.ini file:
94+
# zend_extension="/usr/local/php/modules/xdebug.so"
95+
ARG XDEBUG_VERSION="xdebug"
96+
RUN pecl install ${XDEBUG_VERSION}
97+
98+
# put composer into image
99+
COPY --from=composer-image /usr/bin/composer /usr/bin/composer
100+
ENV COMPOSER_NO_INTERACTION=1
101+
ENV COMPOSER_HOME=/tmp/composer
102+
# show ext-* and lib-* entries one may use in composer.json on this platform
103+
#RUN COMPOSER_ALLOW_SUPERUSER=1 composer show --platform --no-plugins --no-interaction
104+
105+
# Add locale de_DE.UTF-8
106+
RUN echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen
107+
108+
# Add current node version
109+
RUN docker-node-install node_16.x

php83/Dockerfile

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
ARG COMPOSER_VERSION="2"
2+
ARG PHP_VERSION="8.3-fpm-bullseye"
3+
4+
# composer version to make available in built image
5+
FROM composer:${COMPOSER_VERSION} AS composer-image
6+
7+
# php version to actually build
8+
FROM php:${PHP_VERSION} AS base
9+
10+
# bash as default shell should exit on non-zero exit-codes in piped commands
11+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
12+
13+
COPY scripts/docker-apt-clean-install /usr/local/sbin/
14+
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
15+
16+
ENV DEBIAN_FRONTEND=noninteractive
17+
18+
# install software available by default in this image
19+
# hadolint ignore=DL3008,DL3009
20+
RUN docker-apt-clean-install \
21+
calendar \
22+
#coreutils \
23+
#debconf-utils \
24+
#gettext \
25+
git \
26+
wget \
27+
gnupg2 \
28+
#gosu \
29+
libbz2-dev \
30+
#libexif-dev \
31+
libfreetype6-dev \
32+
libjpeg62-turbo-dev \
33+
#libgif-dev \
34+
#libgmp-dev \
35+
libicu-dev \
36+
libjpeg-dev \
37+
libpng-dev \
38+
#libpq-dev \
39+
#libpspell-dev \
40+
#libtidy-dev \
41+
libwebp-dev \
42+
libxml2-dev \
43+
#libxpm-dev \
44+
#libxslt1-dev \
45+
libzip-dev \
46+
locales \
47+
msmtp \
48+
tzdata \
49+
unzip \
50+
zlib1g-dev \
51+
zip \
52+
&& echo "tzdata tzdata/Areas select Europe" | debconf-set-selections \
53+
&& echo "tzdata tzdata/Zones/Europe select Berlin" | debconf-set-selections \
54+
&& rm -f /etc/localtime /etc/timezone \
55+
&& dpkg-reconfigure -f noninteractive tzdata
56+
57+
ENV TZ=Europe/Berlin
58+
59+
# configure and install PHP extensions
60+
RUN docker-php-ext-configure calendar \
61+
&& docker-php-ext-configure gd \
62+
--with-freetype \
63+
--with-jpeg \
64+
--with-webp \
65+
&& docker-php-ext-configure intl \
66+
--enable-intl \
67+
&& docker-php-ext-install -j"$(nproc)" \
68+
bcmath \
69+
bz2 \
70+
calendar \
71+
#exif \
72+
gd \
73+
#gmp \
74+
gettext \
75+
intl \
76+
#mysqli \
77+
opcache \
78+
#pcntl \
79+
pdo_mysql \
80+
#pdo_pgsql \
81+
#pspell \
82+
soap \
83+
#sockets \
84+
#tidy \
85+
#xsl \
86+
zip \
87+
&& rm -rf /usr/src/
88+
89+
FROM base as dev
90+
91+
COPY scripts/ /usr/local/sbin/
92+
93+
# install xdebug – it is not enabled by default though, you need to add the following line to your php.ini file:
94+
# zend_extension="/usr/local/php/modules/xdebug.so"
95+
ARG XDEBUG_VERSION="xdebug"
96+
RUN pecl install ${XDEBUG_VERSION}
97+
98+
# put composer into image
99+
COPY --from=composer-image /usr/bin/composer /usr/bin/composer
100+
ENV COMPOSER_NO_INTERACTION=1
101+
ENV COMPOSER_HOME=/tmp/composer
102+
# show ext-* and lib-* entries one may use in composer.json on this platform
103+
#RUN COMPOSER_ALLOW_SUPERUSER=1 composer show --platform --no-plugins --no-interaction
104+
105+
# Add locale de_DE.UTF-8
106+
RUN echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen
107+
108+
# Add current node version
109+
RUN docker-node-install node_16.x

0 commit comments

Comments
 (0)