Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ZMS-3237): base image for php82 and php83 #8

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,112 @@ on:
- '*'

jobs:
php_v8_3:
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/it-at-m/eappointment-php-base
VERSION: "8.3"
DOCKERFILE: php83/Dockerfile
XDEBUG_VERSION: "xdebug-3.3.0"
COMPOSER_VERSION: "2"
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo "${{ env.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Pull existing image for cache (if any)
run: |
docker pull "${{ env.IMAGE }}:${{ env.VERSION }}-dev" || echo "No preexisting image found"

- name: Build base image
run: |
docker build --pull \
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
--target base \
-f "${{ env.DOCKERFILE }}" \
-t "${{ env.IMAGE }}:${{ env.VERSION }}-base" \
.

- name: Build dev image without cache
run: |
docker build --pull --no-cache \
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
--target dev \
-f "${{ env.DOCKERFILE }}" \
-t "${{ env.IMAGE }}:${{ env.VERSION }}-dev" \
.

- name: Validate PHP setup
run: docker run --rm -i "${{ env.IMAGE }}:${{ env.VERSION }}-dev" php-fpm -t

- name: Push base image to GHCR
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-base"

- name: Push dev image to GHCR
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-dev"

php_v8_2:
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/it-at-m/eappointment-php-base
VERSION: "8.2"
DOCKERFILE: php82/Dockerfile
XDEBUG_VERSION: "xdebug-3.2.0"
COMPOSER_VERSION: "2"
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo "${{ env.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Pull existing image for cache (if any)
run: |
docker pull "${{ env.IMAGE }}:${{ env.VERSION }}-dev" || echo "No preexisting image found"

- name: Build base image
run: |
docker build --pull \
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
--target base \
-f "${{ env.DOCKERFILE }}" \
-t "${{ env.IMAGE }}:${{ env.VERSION }}-base" \
.

- name: Build dev image without cache
run: |
docker build --pull --no-cache \
--build-arg XDEBUG_VERSION=${{ env.XDEBUG_VERSION }} \
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
--target dev \
-f "${{ env.DOCKERFILE }}" \
-t "${{ env.IMAGE }}:${{ env.VERSION }}-dev" \
.

- name: Validate PHP setup
run: docker run --rm -i "${{ env.IMAGE }}:${{ env.VERSION }}-dev" php-fpm -t

- name: Push base image to GHCR
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-base"

- name: Push dev image to GHCR
run: docker push "${{ env.IMAGE }}:${{ env.VERSION }}-dev"

php_v8_1:
runs-on: ubuntu-latest
env:
Expand Down
109 changes: 109 additions & 0 deletions php82/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
ARG COMPOSER_VERSION="2"
ARG PHP_VERSION="8.2-fpm-bullseye"

# composer version to make available in built image
FROM composer:${COMPOSER_VERSION} AS composer-image

# php version to actually build
FROM php:${PHP_VERSION} AS base

# bash as default shell should exit on non-zero exit-codes in piped commands
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY scripts/docker-apt-clean-install /usr/local/sbin/
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

ENV DEBIAN_FRONTEND=noninteractive

# install software available by default in this image
# hadolint ignore=DL3008,DL3009
RUN docker-apt-clean-install \
calendar \
#coreutils \
#debconf-utils \
#gettext \
git \
wget \
gnupg2 \
#gosu \
libbz2-dev \
#libexif-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
#libgif-dev \
#libgmp-dev \
libicu-dev \
libjpeg-dev \
libpng-dev \
#libpq-dev \
#libpspell-dev \
#libtidy-dev \
libwebp-dev \
libxml2-dev \
#libxpm-dev \
#libxslt1-dev \
libzip-dev \
locales \
msmtp \
tzdata \
unzip \
zlib1g-dev \
zip \
&& echo "tzdata tzdata/Areas select Europe" | debconf-set-selections \
&& echo "tzdata tzdata/Zones/Europe select Berlin" | debconf-set-selections \
&& rm -f /etc/localtime /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata

ENV TZ=Europe/Berlin

# configure and install PHP extensions
RUN docker-php-ext-configure calendar \
&& docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
&& docker-php-ext-configure intl \
--enable-intl \
&& docker-php-ext-install -j"$(nproc)" \
bcmath \
bz2 \
calendar \
#exif \
gd \
#gmp \
gettext \
intl \
#mysqli \
opcache \
#pcntl \
pdo_mysql \
#pdo_pgsql \
#pspell \
soap \
#sockets \
#tidy \
#xsl \
zip \
&& rm -rf /usr/src/

FROM base as dev

COPY scripts/ /usr/local/sbin/

# install xdebug – it is not enabled by default though, you need to add the following line to your php.ini file:
# zend_extension="/usr/local/php/modules/xdebug.so"
ARG XDEBUG_VERSION="xdebug"
RUN pecl install ${XDEBUG_VERSION}

# put composer into image
COPY --from=composer-image /usr/bin/composer /usr/bin/composer
ENV COMPOSER_NO_INTERACTION=1
ENV COMPOSER_HOME=/tmp/composer
# show ext-* and lib-* entries one may use in composer.json on this platform
#RUN COMPOSER_ALLOW_SUPERUSER=1 composer show --platform --no-plugins --no-interaction

# Add locale de_DE.UTF-8
RUN echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen

# Add current node version
RUN docker-node-install node_16.x
109 changes: 109 additions & 0 deletions php83/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
ARG COMPOSER_VERSION="2"
ARG PHP_VERSION="8.3-fpm-bullseye"

# composer version to make available in built image
FROM composer:${COMPOSER_VERSION} AS composer-image

# php version to actually build
FROM php:${PHP_VERSION} AS base

# bash as default shell should exit on non-zero exit-codes in piped commands
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY scripts/docker-apt-clean-install /usr/local/sbin/
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

ENV DEBIAN_FRONTEND=noninteractive

# install software available by default in this image
# hadolint ignore=DL3008,DL3009
RUN docker-apt-clean-install \
calendar \
#coreutils \
#debconf-utils \
#gettext \
git \
wget \
gnupg2 \
#gosu \
libbz2-dev \
#libexif-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
#libgif-dev \
#libgmp-dev \
libicu-dev \
libjpeg-dev \
libpng-dev \
#libpq-dev \
#libpspell-dev \
#libtidy-dev \
libwebp-dev \
libxml2-dev \
#libxpm-dev \
#libxslt1-dev \
libzip-dev \
locales \
msmtp \
tzdata \
unzip \
zlib1g-dev \
zip \
&& echo "tzdata tzdata/Areas select Europe" | debconf-set-selections \
&& echo "tzdata tzdata/Zones/Europe select Berlin" | debconf-set-selections \
&& rm -f /etc/localtime /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata

ENV TZ=Europe/Berlin

# configure and install PHP extensions
RUN docker-php-ext-configure calendar \
&& docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
&& docker-php-ext-configure intl \
--enable-intl \
&& docker-php-ext-install -j"$(nproc)" \
bcmath \
bz2 \
calendar \
#exif \
gd \
#gmp \
gettext \
intl \
#mysqli \
opcache \
#pcntl \
pdo_mysql \
#pdo_pgsql \
#pspell \
soap \
#sockets \
#tidy \
#xsl \
zip \
&& rm -rf /usr/src/

FROM base as dev

COPY scripts/ /usr/local/sbin/

# install xdebug – it is not enabled by default though, you need to add the following line to your php.ini file:
# zend_extension="/usr/local/php/modules/xdebug.so"
ARG XDEBUG_VERSION="xdebug"
RUN pecl install ${XDEBUG_VERSION}

# put composer into image
COPY --from=composer-image /usr/bin/composer /usr/bin/composer
ENV COMPOSER_NO_INTERACTION=1
ENV COMPOSER_HOME=/tmp/composer
# show ext-* and lib-* entries one may use in composer.json on this platform
#RUN COMPOSER_ALLOW_SUPERUSER=1 composer show --platform --no-plugins --no-interaction

# Add locale de_DE.UTF-8
RUN echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen

# Add current node version
RUN docker-node-install node_16.x