Added docker composer for php5.6 on alpine
Build and push PHP 5 container images / Build PHP 5 container images (map[composer_ver_short:2.2 composer_version:2.2.25 os:alpine os_version:3.6 php_ver_short:5 php_version:5.6]) (push) Successful in 1m40s Details

This commit is contained in:
Muhamad Aditya Prima 2024-12-16 22:16:38 +07:00
parent a5c22a4332
commit 1c75b7ac19
4 changed files with 105 additions and 35 deletions

View File

@ -0,0 +1,80 @@
name: Build and push PHP 5 container images
on:
push:
branches:
- php5-composer
jobs:
build:
name: Build PHP 5 container images
runs-on: ubuntu-latest
container:
image: ghcr.io/catthehacker/ubuntu:act-latest
strategy:
matrix:
flavors:
- os: "alpine"
os_version: "3.6"
php_version: "5.6"
php_ver_short: "5"
composer_version: "2.2.25"
composer_ver_short: "2.2"
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ vars.QUAY_USERNAME }}
password: ${{ secrets.QUAY_SECRET }}
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Build and push php5 with composer
uses: docker/build-push-action@v5
with:
push: true
context: .
file: 5/Dockerfile.composer-${{ matrix.flavors.os }}
build-args: |
OS_VERSION=${{ matrix.flavors.os_version }}
FLAVOR=${{ matrix.flavors.mode }}
PHP_VERSION=${{ matrix.flavors.php_version }}
PHP_VER_SHORT=${{ matrix.flavors.php_ver_short }}
COMPOSER_VERSION=${{ matrix.flavors.composer_version }}
COMPOSER_VER_SHORT=${{ matrix.flavors.composer_ver_short }}
tags: |
quay.io/sindigilive/php:${{ matrix.flavors.php_version }}-composer${{ matrix.flavors.composer_ver_short }}-${{ matrix.flavors.os }}
# build-latest:
# name: Build latest nginx alpine based container images
# runs-on: ubuntu-latest
# needs:
# - build
# container:
# image: ghcr.io/catthehacker/ubuntu:act-latest
# steps:
# - name: Check out repository code
# uses: actions/checkout@v4
# - name: Login to quay.io
# uses: docker/login-action@v3
# with:
# registry: quay.io
# username: ${{ vars.QUAY_USERNAME }}
# password: ${{ secrets.QUAY_SECRET }}
# # - name: Set up QEMU
# # uses: docker/setup-qemu-action@v3
# - name: Setup Docker buildx
# uses: docker/setup-buildx-action@v3
# - name: Build and push latest nginx
# uses: docker/build-push-action@v5
# with:
# # platforms: linux/amd64,linux/arm64
# push: true
# context: .
# file: Dockerfile.alpine
# tags: |
# quay.io/sindigilive/nginx:alpine
# quay.io/sindigilive/nginx:latest

View File

@ -7,18 +7,27 @@ LABEL maintainer="<Muhamad Aditya Prima> map@sindigilive.com"
ARG PHP_VERSION=5.6
ARG PHP_VER_SHORT=5
ARG COMPOSER_VERSION=2.2.25
ARG COMPOSER_VER_SHORT=2.2
ENV PHP_VERSION=${PHP_VERSION}
ENV PHP_VER_SHORT=${PHP_VER_SHORT}
ENV COMPOSER_VERSION=${COMPOSER_VERSION}
ENV COMPOSER_VER_SHORT=${COMPOSER_VER_SHORT}
# Set composer home
ENV COMPOSER_HOME=/app
ENV COMPOSER_CACHE_DIR=${COMPOSER_HOME}/cache
WORKDIR /root
ENV FLAVOR="full"
ENV WITH_DATABASE="false"
ENV WITH_SERVER="false"
ADD 5/scripts/alpine-composer-setup.sh /tmp/setup.sh
WORKDIR /tmp
ADD 5/scripts/alpine-setup.sh ./setup.sh
# Download and install composer
ADD https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar /usr/local/bin/composer
# Create directory, and install required php app
RUN /bin/mkdir -p ${COMPOSER_HOME}/build ${COMPOSER_CACHE_DIR}/files \
@ -28,10 +37,10 @@ RUN /bin/mkdir -p ${COMPOSER_HOME}/build ${COMPOSER_CACHE_DIR}/files \
/sbin/apk add --update --no-cache \
php${PHP_VER_SHORT} php${PHP_VER_SHORT}-common \
php${PHP_VER_SHORT}-cli ; \
/bin/chown -R composer:composer /app ${COMPOSER_CACHE_DIR} ; \
/bin/chmod +x /tmp/setup.sh; \
/bin/sh /tmp/setup.sh; \
/bin/rm -f /tmp/*.sh;
/bin/chown -R composer:composer ${COMPOSER_HOME} ; \
/bin/chmod 755 ./setup.sh /usr/local/bin/composer ; \
/bin/sh ./setup.sh; \
/bin/rm -f ./*;
# Create symlinks to /usr/bin/php in case it doesn't exists
RUN ln -ns /usr/bin/php${PHP_VER_SHORT} /usr/bin/php ; exit 0
@ -44,10 +53,12 @@ FROM scratch
ARG PHP_VERSION=5.6
ARG PHP_VER_SHORT=5
ARG COMPOSER_VERSION=2.2.25
ARG COMPOSER_VER_SHORT=2.2
ENV PHP_VERSION=${PHP_VERSION}
ENV PHP_VER_SHORT=${PHP_VER_SHORT}
ENV COMPOSER_VERSION=${COMPOSER_VERSION}
ENV COMPOSER_VER_SHORT=${COMPOSER_VER_SHORT}
# Set composer home
ENV COMPOSER_HOME=/app
@ -72,4 +83,4 @@ WORKDIR ${COMPOSER_HOME}/build
STOPSIGNAL SIGQUIT
CMD ["/usr/bin/composer", "-V"]
CMD ["/usr/local/bin/composer", "-V"]

View File

@ -1,21 +0,0 @@
#!/bin/sh
PHP_LIST="bcmath,bz2,calendar,cgi,ctype,
curl,dba,dev,doc,
dom,embed,enchant,exif,ftp,
gd,gettext,gmp,iconv,imap,
intl,json,ldap,mailparse,mcrypt,
memcache,opcache,openssl,pcntl,pdo,
pear,pear-net_socket,phar,phpdbg,
phpmailer,posix,pspell,shmop,
snmp,soap,sockets,sysvmsg,sysvsem,
sysvshm,wddx,xcache,xml,xmlreader,
xmlrpc,xsl,zip,zlib"
PHP_DEPS=""
# Setup php flavor
for i in $(echo $PHP_LIST | tr "," "\n"); do
PHP_DEPS="${PHP_DEPS} php$PHP_VER_SHORT-$i ";
done
/sbin/apk add --update --no-cache $PHP_DEPS;

View File

@ -4,12 +4,12 @@ PHP_LIST="bcmath,bz2,calendar,cgi,ctype,
curl,dba,dev,doc,
dom,embed,enchant,exif,ftp,
gd,gettext,gmp,iconv,imap,
intl,json,ldap,mailparse,mcrypt,
memcache,opcache,openssl,pcntl,pdo,
pear,pear-net_socket,phar,phpdbg,
phpmailer,posix,pspell,shmop,
intl,json,ldap,mcrypt,
opcache,openssl,pcntl,pdo,
pear,phar,phpdbg,
posix,pspell,shmop,
snmp,soap,sockets,sysvmsg,sysvsem,
sysvshm,wddx,xcache,xml,xmlreader,
sysvshm,wddx,xml,xmlreader,
xmlrpc,xsl,zip,zlib"
PHP_DEPS=""
# apache2 configurations