From b56637606e619fdb6e64aed15852101651f9b2bc Mon Sep 17 00:00:00 2001 From: Ilya Bulakh Date: Tue, 14 Nov 2023 15:08:17 +0300 Subject: [PATCH] major updates (#61) --- .github/workflows/build.yml | 70 ++++++++++++++++++++++ .github/workflows/test_dockerfile.yml | 36 ----------- 7.4/Dockerfile | 28 --------- 7.4/alpine/Dockerfile | 28 --------- 7.4/apache/Dockerfile | 28 --------- 7.4/fpm-alpine/Dockerfile | 28 --------- 7.4/fpm/Dockerfile | 28 --------- 8.0/Dockerfile | 23 ------- 8.0/alpine/Dockerfile | 29 --------- 8.1/Dockerfile => Dockerfile | 16 ++--- 8.1/alpine/Dockerfile => Dockerfile-alpine | 18 +++--- Makefile | 23 +------ README.md | 1 + update.sh | 54 ----------------- 14 files changed, 89 insertions(+), 321 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/test_dockerfile.yml delete mode 100644 7.4/Dockerfile delete mode 100644 7.4/alpine/Dockerfile delete mode 100644 7.4/apache/Dockerfile delete mode 100644 7.4/fpm-alpine/Dockerfile delete mode 100644 7.4/fpm/Dockerfile delete mode 100644 8.0/Dockerfile delete mode 100644 8.0/alpine/Dockerfile rename 8.1/Dockerfile => Dockerfile (54%) rename 8.1/alpine/Dockerfile => Dockerfile-alpine (62%) delete mode 100755 update.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..dbd1f4e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: ci + +on: + pull_request: + push: + branches: + - master + +env: + IMAGE_NAME: mileschou/phalcon + PHALCON_VERSION: 5.3.1 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 8 + fail-fast: true + matrix: + php: + - 8.2 + - 8.1 + - "8.0" + - 7.4 + variant: + - "" # cli + - -fpm + os: + - "" # debian-latest + - -alpine + env: + PHP_VARIANT: ${{ matrix.php }}${{ matrix.variant }}${{ matrix.os }} + + steps: + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build + uses: docker/build-push-action@v5 + with: + load: true + file: Dockerfile${{ matrix.os }} + build-args: | + PHP_VARIANT=${{ env.PHP_VARIANT }} + PHALCON_VERSION=${{ env.PHALCON_VERSION }} + tags: ${{ env.IMAGE_NAME }}:${{ env.PHP_VARIANT }}-tesing + - + name: Test + run: docker run --rm ${{ env.IMAGE_NAME }}:${{ env.PHP_VARIANT }}-tesing sh -c "php -v; php --ri phalcon | grep -i ^version" + + - + name: Login + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v5 + with: + push: true + file: Dockerfile${{ matrix.os }} + build-args: | + PHP_VARIANT=${{ env.PHP_VARIANT }} + PHALCON_VERSION=${{ env.PHALCON_VERSION }} + platforms: linux/amd64,linux/arm64 + tags: ${{ env.IMAGE_NAME }}:${{ env.PHP_VARIANT }} diff --git a/.github/workflows/test_dockerfile.yml b/.github/workflows/test_dockerfile.yml deleted file mode 100644 index 41d4c1d..0000000 --- a/.github/workflows/test_dockerfile.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Test Dockerfile - -on: - pull_request: - push: - branches: - - master - -jobs: - php80_debian_v5: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Build on 8.0/Dockerfile - run: docker build --progress=plain --file 8.0/Dockerfile . - - php80_alpine_v5: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Build on 8.0/alpine/Dockerfile - run: docker build --progress=plain --file 8.0/alpine/Dockerfile . - - php81_debian_v5: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Build on 8.1/Dockerfile - run: docker build --progress=plain --file 8.1/Dockerfile . - - php81_alpine_v5: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Build on 8.1/alpine/Dockerfile - run: docker build --progress=plain --file 8.1/alpine/Dockerfile . diff --git a/7.4/Dockerfile b/7.4/Dockerfile deleted file mode 100644 index e2381b7..0000000 --- a/7.4/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM php:7.4 - -LABEL maintainer="MilesChou , fizzka " - -ARG PSR_VERSION=1.1.0 -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - # Download PSR, see https://github.com/jbboehr/php-psr - curl -LO https://github.com/jbboehr/php-psr/archive/v${PSR_VERSION}.tar.gz && \ - tar xzf /v${PSR_VERSION}.tar.gz && \ - # Download Phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /php-psr-${PSR_VERSION} \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PSR_VERSION}.tar.gz \ - /php-psr-${PSR_VERSION} \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/7.4/alpine/Dockerfile b/7.4/alpine/Dockerfile deleted file mode 100644 index 93302ea..0000000 --- a/7.4/alpine/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM php:7.4-alpine - -LABEL maintainer="MilesChou , fizzka " - -ARG PSR_VERSION=1.1.0 -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - # Download PSR, see https://github.com/jbboehr/php-psr - curl -LO https://github.com/jbboehr/php-psr/archive/v${PSR_VERSION}.tar.gz && \ - tar xzf /v${PSR_VERSION}.tar.gz && \ - # Download Phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /php-psr-${PSR_VERSION} \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PSR_VERSION}.tar.gz \ - /php-psr-${PSR_VERSION} \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/7.4/apache/Dockerfile b/7.4/apache/Dockerfile deleted file mode 100644 index 4ef9b93..0000000 --- a/7.4/apache/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM php:7.4-apache - -LABEL maintainer="MilesChou , fizzka " - -ARG PSR_VERSION=1.1.0 -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - # Download PSR, see https://github.com/jbboehr/php-psr - curl -LO https://github.com/jbboehr/php-psr/archive/v${PSR_VERSION}.tar.gz && \ - tar xzf /v${PSR_VERSION}.tar.gz && \ - # Download Phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /php-psr-${PSR_VERSION} \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PSR_VERSION}.tar.gz \ - /php-psr-${PSR_VERSION} \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/7.4/fpm-alpine/Dockerfile b/7.4/fpm-alpine/Dockerfile deleted file mode 100644 index 22a87d0..0000000 --- a/7.4/fpm-alpine/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM php:7.4-fpm-alpine - -LABEL maintainer="MilesChou , fizzka " - -ARG PSR_VERSION=1.1.0 -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - # Download PSR, see https://github.com/jbboehr/php-psr - curl -LO https://github.com/jbboehr/php-psr/archive/v${PSR_VERSION}.tar.gz && \ - tar xzf /v${PSR_VERSION}.tar.gz && \ - # Download Phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /php-psr-${PSR_VERSION} \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PSR_VERSION}.tar.gz \ - /php-psr-${PSR_VERSION} \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/7.4/fpm/Dockerfile b/7.4/fpm/Dockerfile deleted file mode 100644 index bbad7f8..0000000 --- a/7.4/fpm/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM php:7.4-fpm - -LABEL maintainer="MilesChou , fizzka " - -ARG PSR_VERSION=1.1.0 -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - # Download PSR, see https://github.com/jbboehr/php-psr - curl -LO https://github.com/jbboehr/php-psr/archive/v${PSR_VERSION}.tar.gz && \ - tar xzf /v${PSR_VERSION}.tar.gz && \ - # Download Phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /php-psr-${PSR_VERSION} \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PSR_VERSION}.tar.gz \ - /php-psr-${PSR_VERSION} \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/8.0/Dockerfile b/8.0/Dockerfile deleted file mode 100644 index 382e5e2..0000000 --- a/8.0/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM php:8.0 - -LABEL maintainer="MilesChou , fizzka " - -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - docker-php-source extract && \ - # Install ext-phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - docker-php-source delete && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/8.0/alpine/Dockerfile b/8.0/alpine/Dockerfile deleted file mode 100644 index 821bcc4..0000000 --- a/8.0/alpine/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM php:8.0-alpine - -LABEL maintainer="MilesChou , fizzka " - -ARG PHALCON_VERSION=5.0.4 - -RUN set -xe && \ - docker-php-source extract && \ - apk add --no-cache --virtual .build-deps \ - autoconf \ - g++ \ - make \ - && \ - # Install ext-phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ - docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ - && \ - # Remove all temp files - rm -r \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ - docker-php-source delete && \ - apk del .build-deps && \ - php -m - -COPY docker-phalcon-* /usr/local/bin/ diff --git a/8.1/Dockerfile b/Dockerfile similarity index 54% rename from 8.1/Dockerfile rename to Dockerfile index 7ba966d..6b455d6 100644 --- a/8.1/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM php:8.1 +ARG PHP_VARIANT=8.2 + +FROM php:${PHP_VARIANT} LABEL maintainer="MilesChou , fizzka " @@ -7,16 +9,14 @@ ARG PHALCON_VERSION=5.0.4 RUN set -xe && \ docker-php-source extract && \ # Install ext-phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ + cd /tmp && \ + curl -LO https://github.com/phalcon/cphalcon/releases/download/v${PHALCON_VERSION}/phalcon-pecl.tgz && \ + tar xzf phalcon-pecl.tgz && \ docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ + /tmp/phalcon-${PHALCON_VERSION} \ && \ # Remove all temp files - rm -r \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ + rm -r /tmp/phalcon-* && \ docker-php-source delete && \ php -m diff --git a/8.1/alpine/Dockerfile b/Dockerfile-alpine similarity index 62% rename from 8.1/alpine/Dockerfile rename to Dockerfile-alpine index 209d7dd..19fdd20 100644 --- a/8.1/alpine/Dockerfile +++ b/Dockerfile-alpine @@ -1,9 +1,11 @@ -FROM php:8.1-alpine +ARG PHP_VARIANT=8.2 -LABEL maintainer="MilesChou , fizzka " +FROM php:${PHP_VARIANT} ARG PHALCON_VERSION=5.0.4 +LABEL maintainer="MilesChou , fizzka " + RUN set -xe && \ apk add --no-cache --virtual .build-deps \ autoconf \ @@ -12,16 +14,14 @@ RUN set -xe && \ && \ docker-php-source extract && \ # Install ext-phalcon - curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \ - tar xzf /v${PHALCON_VERSION}.tar.gz && \ + cd /tmp && \ + curl -LO https://github.com/phalcon/cphalcon/releases/download/v${PHALCON_VERSION}/phalcon-pecl.tgz && \ + tar xzf phalcon-pecl.tgz && \ docker-php-ext-install -j $(getconf _NPROCESSORS_ONLN) \ - /cphalcon-${PHALCON_VERSION}/build/phalcon \ + /tmp/phalcon-${PHALCON_VERSION} \ && \ # Remove all temp files - rm -r \ - /v${PHALCON_VERSION}.tar.gz \ - /cphalcon-${PHALCON_VERSION} \ - && \ + rm -r /tmp/phalcon-* && \ docker-php-source delete && \ apk del .build-deps && \ php -m diff --git a/Makefile b/Makefile index b661086..d702dde 100644 --- a/Makefile +++ b/Makefile @@ -3,30 +3,9 @@ IMAGE := mileschou/phalcon VERSION := 5.0.4 DEVTOOLS_VERSION := 4.0.3 -.PHONY: all build variants push clean -.PHONY: 8.1 8.0 7.4 +.PHONY: variants clean # ------------------------------------------------------------------------------ - -all: build - -build: 8.1 8.0 7.4 - -8.1: - docker build --progress=plain -t=$(IMAGE):8.1 -f 8.1/Dockerfile . - docker build --progress=plain -t=$(IMAGE):8.1-alpine -f 8.1/alpine/Dockerfile . - -8.0: - docker build --progress=plain -t=$(IMAGE):8.0 -f 8.0/Dockerfile . - docker build --progress=plain -t=$(IMAGE):8.0-alpine -f 8.0/alpine/Dockerfile . - -7.4: - docker build --progress=plain -t=$(IMAGE):7.4 -f 7.4/Dockerfile . - docker build --progress=plain -t=$(IMAGE):7.4-alpine -f 7.4/alpine/Dockerfile . - docker build --progress=plain -t=$(IMAGE):7.4-apache -f 7.4/apache/Dockerfile . - docker build --progress=plain -t=$(IMAGE):7.4-fpm -f 7.4/fpm/Dockerfile . - docker build --progress=plain -t=$(IMAGE):7.4-fpm-alpine -f 7.4/fpm-alpine/Dockerfile . - variants: php @find php -name "Dockerfile" | sed 's/php\/\(.*\)\/Dockerfile/\1/' diff --git a/README.md b/README.md index c1fb8d8..ea0461b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![Phalcon devtools](https://img.shields.io/badge/phalcon--devtools-4.2.0-blue.svg) [![](https://img.shields.io/docker/stars/mileschou/phalcon.svg)](https://hub.docker.com/r/mileschou/phalcon/) [![](https://img.shields.io/docker/pulls/mileschou/phalcon.svg)](https://hub.docker.com/r/mileschou/phalcon/) +[![ci](https://github.com/fizzka/docker-phalcon/actions/workflows/build.yml/badge.svg)](https://github.com/fizzka/docker-phalcon/actions/workflows/build.yml) Docker Phalcon base image, see [DockerHub](https://hub.docker.com/r/mileschou/phalcon/). diff --git a/update.sh b/update.sh deleted file mode 100755 index 1d62f0b..0000000 --- a/update.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -generated_warning() { - cat <<-EOH - # - # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" - # - # PLEASE DO NOT EDIT IT DIRECTLY. - # - EOH -} - -generate_dockerfile() { - variants=$1 - - if [[ "$variants" != "" ]]; then - path=/$1 - version_suffix=-${variants} - else - path="" - version_suffix="" - fi - - # Prepare directories - mkdir -p ${version}${path} - - generated_warning > ${version}${path}/Dockerfile - - cat Dockerfile.template | \ - sed -e 's!%%PHP_VERSION%%!'"${version}${version_suffix}"'!' | \ - sed -e 's!%%PSR_VERSION%%!'"${PSR_VERSION}"'!' | \ - sed -e 's!%%PHALCON_VERSION%%!'"${PHALCON_VERSION}"'!' \ - >> ${version}${path}/Dockerfile -} - -PSR_VERSION=1.1.0 -PHALCON_VERSION=4.1.2 - -# Dockerfile on PHP 7 is customized -VERSIONS=" -7.2 -7.3 -7.4 -" - -for version in ${VERSIONS}; do - major_version=$(echo ${version} | cut -f1 -d.) - - generate_dockerfile - generate_dockerfile alpine - generate_dockerfile apache - generate_dockerfile fpm - generate_dockerfile fpm-alpine -done