Skip to content

Commit

Permalink
Make composer version configurable (#27)
Browse files Browse the repository at this point in the history
* Make composer version configurable
* Remove choice from legacy script
  • Loading branch information
joernott authored Jul 2, 2024
1 parent 6772104 commit 7e0b3a0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build-legacy-php-images.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Build php 7.1/7.2/7.3 images and push to Docker Hub
name: Build php 7.1 image and push to Docker Hub

on:
workflow_dispatch:
inputs:
php_version:
type: choice
options:

jobs:
build:
Expand All @@ -25,6 +21,7 @@ jobs:
PHP_MEMORY_LIMIT: "-1"
GD_CONFIG: "--with-jpeg-dir=/usr/local/"
XDEBUG_INI: "xdebug.ini"
COMPOSER_VERSION: "2.2"
steps:
- name: build and push docker images
uses: 'OXID-eSales/github-actions/build_docker@v4'
Expand All @@ -41,6 +38,7 @@ jobs:
GD_CONFIG=${{ matrix.GD_CONFIG }}
PECL_DEPS=${{ matrix.PECL_DEPS }}
XDEBUG_INI=${{ matrix.XDEBUG_INI }}
COMPOSER_VERSION=${{ matrix.COMPOSER_VERSION }}
tags: |
oxidesales/oxideshop-docker-php:${{ matrix.php_version }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build-php-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,39 @@ jobs:
GD_CONFIG: "--with-jpeg=/usr/local/"
PECL_DEPS: "pecl install xdebug-3.1.3 memcached"
XDEBUG_INI: "xdebug3.ini"
COMPOSER_VERSION: 2
- php_version: 8.0
RUNTIME_PACKAGE_DEPS: "msmtp libfreetype6 libjpeg62-turbo libwebp6 unzip git default-mysql-client sudo rsync liblz4-tool libzip-dev bc iproute2 libmemcached-dev libonig-dev openssh-client sshpass libgd3"
BUILD_PACKAGE_DEPS: "libcurl4-openssl-dev libjpeg-dev libpng-dev libwebp-dev libxml2-dev"
PHP_EXT_DEPS: "zip bcmath soap pdo_mysql gd mysqli"
GD_CONFIG: "--with-jpeg=/usr/local/ --with-webp"
PECL_DEPS: "pecl install xdebug-3.1.3 memcached"
XDEBUG_INI: "xdebug3.ini"
COMPOSER_VERSION: 2
- php_version: 8.1
RUNTIME_PACKAGE_DEPS: "msmtp libfreetype6 libjpeg62-turbo libwebp-dev unzip git default-mysql-client sudo rsync liblz4-tool libzip-dev bc iproute2 libmemcached-dev libonig-dev openssh-client sshpass libssl-dev libgd3 libavif15"
BUILD_PACKAGE_DEPS: "libcurl4-openssl-dev libjpeg-dev libpng-dev libwebp-dev libxml2-dev libavif-dev"
PHP_EXT_DEPS: "zip bcmath soap pdo_mysql gd mysqli"
GD_CONFIG: "--with-jpeg=/usr/local/ --with-webp=/usr/local/ --with-avif"
PECL_DEPS: "pecl install xdebug memcached"
XDEBUG_INI: "xdebug3.ini"
COMPOSER_VERSION: 2
- php_version: 8.2
RUNTIME_PACKAGE_DEPS: "msmtp libfreetype6 libjpeg62-turbo libwebp-dev unzip git default-mysql-client sudo rsync liblz4-tool libzip-dev bc iproute2 libmemcached-dev libonig-dev openssh-client sshpass libssl-dev libgd3 libavif15"
BUILD_PACKAGE_DEPS: "libcurl4-openssl-dev libjpeg-dev libpng-dev libxml2-dev libavif-dev"
PHP_EXT_DEPS: "zip bcmath soap pdo_mysql gd mysqli"
GD_CONFIG: "--with-jpeg=/usr/local/ --with-webp=/usr/local/ --with-avif"
PECL_DEPS: "pecl install xdebug memcached"
XDEBUG_INI: "xdebug3.ini"
COMPOSER_VERSION: 2
- php_version: 8.3
RUNTIME_PACKAGE_DEPS: "msmtp libfreetype6 libjpeg62-turbo libwebp-dev unzip git default-mysql-client sudo rsync liblz4-tool libzip-dev bc iproute2 libmemcached-dev libonig-dev openssh-client sshpass libssl-dev libgd3 libavif15"
BUILD_PACKAGE_DEPS: "libcurl4-openssl-dev libjpeg-dev libpng-dev libxml2-dev libavif-dev"
PHP_EXT_DEPS: "zip bcmath soap pdo_mysql gd mysqli"
GD_CONFIG: "--with-jpeg=/usr/local/ --with-webp=/usr/local/ --with-avif"
PECL_DEPS: "pecl install xdebug memcached"
XDEBUG_INI: "xdebug3.ini"
COMPOSER_VERSION: 2
steps:
- name: build and push docker images
uses: 'OXID-eSales/github-actions/build_docker@v4'
Expand All @@ -71,6 +76,7 @@ jobs:
GD_CONFIG=${{ matrix.GD_CONFIG }}
PECL_DEPS=${{ matrix.PECL_DEPS }}
XDEBUG_INI=${{ matrix.XDEBUG_INI }}
COMPOSER_VERSION=${{ matrix.COMPOSER_VERSION }}
tags: |
oxidesales/oxideshop-docker-php:${{ matrix.php_version }}
Expand Down
10 changes: 7 additions & 3 deletions php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
ARG COMPOSER_VERSION=2
ARG PHP_VERSION=7.0
FROM php:$PHP_VERSION-fpm

# Workaround for copy --from not accepting arguments
FROM composer:${COMPOSER_VERSION} as dynamic_composer

FROM php:${PHP_VERSION}-fpm
ARG RUNTIME_PACKAGE_DEPS="msmtp libfreetype6 libjpeg62-turbo libwebp6 unzip git default-mysql-client sudo rsync liblz4-tool bc libmemcached-dev openssh-client sshpass"
ARG BUILD_PACKAGE_DEPS="libcurl4-openssl-dev libjpeg-dev libpng-dev libwebp-dev libxml2-dev zlib1g-dev"
ARG PHP_EXT_DEPS="curl json xml mbstring zip bcmath soap pdo_mysql gd mysqli"
Expand Down Expand Up @@ -46,8 +50,8 @@ RUN ln -s /usr/local/bin/php /usr/bin/php
# install latest composer v1 as composer1 binary
COPY --from=composer:1 /usr/bin/composer /usr/bin/composer1

# install composer v2.2 as composer2 binary (latest or 2 drops php 7.1)
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
# install latest composer v2 (attention: latest or 2 drops php 7.1)
COPY --from=dynamic_composer /usr/bin/composer /usr/bin/composer

# Workaround for https://oxid-esales.atlassian.net/browse/OXDEV-4797
RUN echo "php_admin_value[error_log] = /tmp/fpm-php.www.log" >> /usr/local/etc/php-fpm.d/www.conf
Expand Down
3 changes: 3 additions & 0 deletions php/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if [[ $1 == "5.6" ]]; then
DOCKER_BUILD_ARGUMENTS=()
DOCKER_BUILD_ARGUMENTS+=('--build-arg PHP_VERSION=5.6')
DOCKER_BUILD_ARGUMENTS+=("--build-arg PECL_DEPS='pecl install xdebug-2.5.5 memcached-2.2.0'")
DOCKER_BUILD_ARGUMENTS+=("--build-arg COMPOSER_VERSION='2.2'")
BUILD="docker build --no-cache ${DOCKER_BUILD_ARGUMENTS[*]} -t oxidesales/oxideshop-docker-php:5.6 ."
echo $BUILD
eval $BUILD
Expand All @@ -13,6 +14,7 @@ fi
if [[ $1 == "7.0" ]]; then
DOCKER_BUILD_ARGUMENTS=()
DOCKER_BUILD_ARGUMENTS+=("--build-arg PECL_DEPS='pecl install xdebug-2.7.2 memcached'")
DOCKER_BUILD_ARGUMENTS+=("--build-arg COMPOSER_VERSION='2.2'")
BUILD="docker build --no-cache ${DOCKER_BUILD_ARGUMENTS[*]} -t oxidesales/oxideshop-docker-php:7.0 ."
echo $BUILD
eval $BUILD
Expand All @@ -23,6 +25,7 @@ if [[ $1 == "7.1" ]]; then
DOCKER_BUILD_ARGUMENTS=()
DOCKER_BUILD_ARGUMENTS+=('--build-arg PHP_VERSION=7.1')
DOCKER_BUILD_ARGUMENTS+=("--build-arg PECL_DEPS='pecl install xdebug-2.9.8 memcached'")
DOCKER_BUILD_ARGUMENTS+=("--build-arg COMPOSER_VERSION='2.2'")
BUILD="docker build --no-cache ${DOCKER_BUILD_ARGUMENTS[*]} -t oxidesales/oxideshop-docker-php:7.1 ."
echo $BUILD
eval $BUILD
Expand Down

0 comments on commit 7e0b3a0

Please sign in to comment.