diff --git a/.gitea/workflows/php5-composer.yaml b/.gitea/workflows/php5-composer.yaml new file mode 100644 index 0000000..0f6e4eb --- /dev/null +++ b/.gitea/workflows/php5-composer.yaml @@ -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 diff --git a/5/Dockerfile.composer-alpine b/5/Dockerfile.composer-alpine index d67e810..b2aafa1 100644 --- a/5/Dockerfile.composer-alpine +++ b/5/Dockerfile.composer-alpine @@ -7,18 +7,27 @@ LABEL maintainer=" 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"] diff --git a/5/scripts/alpine-composer-setup.sh b/5/scripts/alpine-composer-setup.sh deleted file mode 100644 index 3a1df7b..0000000 --- a/5/scripts/alpine-composer-setup.sh +++ /dev/null @@ -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; diff --git a/5/scripts/alpine-setup.sh b/5/scripts/alpine-setup.sh index afa0376..ae2311f 100644 --- a/5/scripts/alpine-setup.sh +++ b/5/scripts/alpine-setup.sh @@ -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 @@ -57,10 +57,10 @@ if [ "$WITH_APACHE" == "true" ]; then fi fi -if ["$WITH_DATABASE" == "postgresql"]; then +if [ "$WITH_DATABASE" == "postgresql" ]; then /sbin/apk add --update --no-cache php$PHP_VER_SHORT-pdo php$PHP_VER_SHORT-pdo_pgsql php$PHP_VER_SHORT-pgsql ; fi -if ["$WITH_DATABASE" == "mysql"]; then +if [ "$WITH_DATABASE" == "mysql" ]; then /sbin/apk add --update --no-cache php$PHP_VER_SHORT-pdo php$PHP_VER_SHORT-pdo_mysql php$PHP_VER_SHORT-mysql php$PHP_VER_SHORT-mysqli ; fi \ No newline at end of file