diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 0000000..4f9d973 --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -0,0 +1,65 @@ +name: Image Build +on: + workflow_call: + +jobs: + build-image: + name: Build and push Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/digiblink/alpine-nginx-php74-pdf + tags: | + type=sha + type=ref,event=tag + type=raw,value=latest,enable={{is_default_branch}} + flavor: | + latest=auto + prefix=,onlatest=false + suffix= + labels: | + org.opencontainers.image.vendor=digiBlink + org.opencontainers.image.source=https://github.com/${{ env.REPO_NAME }} + org.opencontainers.image.title=Alpine based image with latest PHP7.4 FPM, Nginx and wkhtmltopdf + org.opencontainers.image.description=Alpine based image with latest PHP7.4 FPM, Nginx and wkhtmltopdf + org.opencontainers.image.created=${{ steps.time.outputs.time }} + org.opencontainers.image.revision=${{ steps.short-sha.outputs.sha }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ vars.DH_USER }} + password: ${{ secrets.DH_PAT }} + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image and push to GitHub Container Registry + uses: docker/build-push-action@v6 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/main_build.yaml b/.github/workflows/main_build.yaml deleted file mode 100644 index bda8788..0000000 --- a/.github/workflows/main_build.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Main Branch CI Image Build -on: - push: - branches: main -jobs: - build-image: - name: Build and push Docker image - runs-on: ubuntu-latest - env: - GHCR_PAT: ${{secrets.GHCR_PAT}} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/digiblink/alpine-nginx-php74-pdf - tags: | - type=sha,prefix= - flavor: | - latest=true - prefix= - suffix= - labels: | - org.opencontainers.image.vendor=digiBlink - - name: Login to Github Packages - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GHCR_PAT }} - - name: Build image and push to GitHub Container Registry - uses: docker/build-push-action@v5 - with: - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/pr_build.yaml b/.github/workflows/pr_build.yaml deleted file mode 100644 index 261dbf6..0000000 --- a/.github/workflows/pr_build.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: PR CI Image Build -on: pull_request -jobs: - build-image: - name: Build Docker and push image - runs-on: ubuntu-latest - env: - GHCR_PAT: ${{secrets.GHCR_PAT}} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/digiblink/alpine-nginx-php74-pdf - tags: | - type=sha,prefix=pr- - flavor: | - latest=false - prefix= - suffix= - labels: | - org.opencontainers.image.vendor=digiBlink - - name: Login to Github Packages - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GHCR_PAT }} - - name: Build image and push to GitHub Container Registry - uses: docker/build-push-action@v5 - with: - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/trigger-main-tag.yaml b/.github/workflows/trigger-main-tag.yaml new file mode 100644 index 0000000..b642e27 --- /dev/null +++ b/.github/workflows/trigger-main-tag.yaml @@ -0,0 +1,13 @@ +name: Trigger on Merge to Main / Tag + +on: + push: + branches: + - main + tags: + - '*' + +jobs: + build-image: + uses: ./.github/workflows/build-image.yaml + secrets: inherit diff --git a/.github/workflows/trigger-pr.yaml b/.github/workflows/trigger-pr.yaml new file mode 100644 index 0000000..38053a4 --- /dev/null +++ b/.github/workflows/trigger-pr.yaml @@ -0,0 +1,13 @@ +name: Trigger on PR + +on: + pull_request: + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + build-image: + uses: ./.github/workflows/build-image.yaml + secrets: inherit diff --git a/Dockerfile b/Dockerfile index e81ce61..0d6f7b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,16 @@ # final stage FROM php:7.4.33-fpm-alpine3.16@sha256:0aeb129a60daff2874c5c70fcd9d88cdf3015b4fb4cc7c3f1a32a21e84631036 -LABEL org.opencontainers.image.source https://github.com/digiblink/alpine-nginx-php74-pdf -LABEL org.opencontainers.image.description Alpine Linux Docker image with Nginx, PHP-FPM and wkhtmltopdf +LABEL org.opencontainers.image.source="https://github.com/digiblink/alpine-nginx-php74-pdf" +LABEL org.opencontainers.image.description="Alpine Linux Docker image with Nginx, PHP-FPM and wkhtmltopdf" -RUN apk -u add nginx wkhtmltopdf +RUN apk -u add nginx \ + && apk add icu-libs=67.1-r2 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/main \ + && apk add qt5-qtbase=5.15.3_git20210406-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \ + && apk add qt5-qtbase-x11=5.15.3_git20210406-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \ + && apk add qt5-qtsvg=5.15.3_git20200406-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \ + && apk add qt5-qtwebkit=5.212.0_alpha4-r14 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \ + && apk add wkhtmltopdf=0.12.6-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community RUN docker-php-ext-install pdo_mysql \ && docker-php-ext-install opcache @@ -20,7 +26,7 @@ RUN { \ # phalcon version setting ARG PSR_VERSION=1.2.0 -ARG PHALCON_VERSION=5.8.0 +ARG PHALCON_VERSION=4.1.3 ARG PHALCON_EXT_PATH=php7/64bits RUN set -xe && \