Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jetsung committed Jan 30, 2024
1 parent d4c6883 commit 87319b9
Show file tree
Hide file tree
Showing 41 changed files with 1,740 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
IMAGE_VERSION=8.0.151
NGINX_VERSION=1.21.5

GH_MIRROR_URL=https://ghproxy.com/

D_PUSH=false
D_PLATFORM="linux/amd64"
118 changes: 118 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: build-push

on:
workflow_dispatch:
inputs:
platforms:
description: "buildx platforms"
default: "linux/amd64,linux/arm64"
required: true
type: string
nginx:
description: "nginx version"
default: "1.24.0"
required: true
type: string
php83:
description: "php8.3 image. e.g: 8.3.000"
default: ""
type: string
php82:
description: "php8.2 image. e.g: 8.2.010"
default: ""
type: string
php81:
description: "php8.1 image. e.g: 8.1.100"
default: ""
type: string

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
nginx: ["${{ inputs.nginx }}"]
php: ["8.3", "8.2", "8.1"]
include:
- php: "8.3"
tag: ${{ inputs.php83 }}
- php: "8.2"
tag: ${{ inputs.php82 }}
- php: "8.1"
tag: ${{ inputs.php81 }}
fail-fast: true

steps:
- id: update
name: Update image
run: |
echo "nginx: ${{ matrix.nginx }}"
echo "tag: ${{ matrix.tag }}"
if [[ -z "${{ matrix.nginx }}" ]] || [[ -z "${{ matrix.tag }}" ]]; then
echo "no, no update"
echo "update=no" >> $GITHUB_OUTPUT
else
echo "yes, update"
echo "update=yes" >> $GITHUB_OUTPUT
fi
- name: Generate tags
id: meta
if: steps.update.outputs.update == 'yes'
env:
IMAGES: "${{ secrets.DOCKERHUB_USERNAME }}/nginx-php ghcr.io/${{ github.actor }}/nginx-php"
run: |
IMAGE_TAGS=''
IFS=' ' read -ra IMAGE <<< "$IMAGES"
for element in "${IMAGE[@]}"; do
LAT_VER=''
if [[ "${{ matrix.php }}" == "8.3" ]]; then
LAT_VER="${element}:latest,"
fi
PRE_VER="${element}:${{ matrix.php }},"
FUL_VER="${element}:${{ matrix.tag }},"
IMAGE_TAG="${LAT_VER}${PRE_VER}${FUL_VER}"
IMAGE_TAGS="${IMAGE_TAGS}${IMAGE_TAG}"
done
echo "IMAGE_TAGS=$IMAGE_TAGS" >> "$GITHUB_OUTPUT"
- name: Set build args
if: steps.meta.outputs.IMAGE_TAGS != ''
run: |
PHP_VER=$(echo "${{ matrix.tag }}" | awk -F'.' '{ printf "%d.%d.%d", $1, $2, int($3/10) }')
echo "NGINX_VERSION=${{ matrix.nginx }}" >> $GITHUB_ENV
echo "PHP_VERSION=$PHP_VER" >> $GITHUB_ENV
- name: Check out the repo
uses: actions/checkout@v4
if: steps.meta.outputs.IMAGE_TAGS != ''
- name: Login into registry docker
uses: docker/login-action@v3
if: steps.meta.outputs.IMAGE_TAGS != ''
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login into registry ghcr
uses: docker/login-action@v3
if: steps.meta.outputs.IMAGE_TAGS != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: steps.meta.outputs.IMAGE_TAGS != ''
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: steps.meta.outputs.IMAGE_TAGS != ''
- name: Build and push
uses: docker/build-push-action@v5
if: steps.meta.outputs.IMAGE_TAGS != ''
with:
platforms: ${{ inputs.platforms }}
file: Dockerfile
build-args: |
NGINX_VERSION=${{ env.NGINX_VERSION }}
PHP_VERSION=${{ env.PHP_VERSION }}
push: true
tags: "${{ steps.meta.outputs.IMAGE_TAGS }}"
51 changes: 51 additions & 0 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths:
- .github/workflows/jekyll-gh-pages.yml
- docs/**

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
87 changes: 87 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: test-ci

on:
workflow_dispatch:
inputs:
platforms:
description: "buildx platforms"
default: "linux/amd64,linux/arm64"
required: true
type: string
nginx:
description: "nginx version"
default: "1.24.0"
required: true
type: string
php83:
description: "e.g: 8.3.000"
default: ""
type: string
php82:
description: "e.g: 8.2.010"
default: ""
type: string
php81:
description: "e.g: 8.1.100"
default: ""
type: string

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
nginx: ["${{ inputs.nginx }}"]
php: ["8.3", "8.2", "8.1"]
include:
- php: "8.3"
tag: ${{ inputs.php83 }}
- php: "8.2"
tag: ${{ inputs.php82 }}
- php: "8.1"
tag: ${{ inputs.php81 }}
fail-fast: true

steps:
- id: update
name: Update image
run: |
echo "nginx: ${{ matrix.nginx }}"
echo "tag: ${{ matrix.tag }}"
if [[ -z "${{ matrix.nginx }}" ]] || [[ -z "${{ matrix.tag }}" ]]; then
echo "no, no update"
echo "update=no" >> $GITHUB_OUTPUT
else
echo "yes, update"
echo "update=yes" >> $GITHUB_OUTPUT
fi
- name: Matrix => (${{ matrix.php }} - ${{ matrix.tag }})
if: steps.update.outputs.update == 'yes'
run: |
echo "update: ${{steps.update.outputs.update}}"
echo ${{ matrix.nginx }}
echo ${{ matrix.php }}
echo ${{ matrix.tag }}
- name: Generate tags
id: meta
if: steps.update.outputs.update == 'yes'
env:
IMAGES: "${{ secrets.DOCKERHUB_USERNAME }}/nginx-php ghcr.io/${{ github.actor }}/nginx-php"
run: |
IMAGE_TAGS=''
IFS=' ' read -ra IMAGE <<< "$IMAGES"
for element in "${IMAGE[@]}"; do
LAT_VER=''
if [[ "${{ matrix.php }}" == "8.3" ]]; then
LAT_VER="${element}:latest,"
fi
PRE_VER="${element}:${{ matrix.php }},"
FUL_VER="${element}:${{ matrix.tag }},"
IMAGE_TAG="${LAT_VER}${PRE_VER}${FUL_VER}"
IMAGE_TAGS="${IMAGE_TAGS}${IMAGE_TAG}"
done
echo "IMAGE_TAGS=$IMAGE_TAGS" >> "$GITHUB_OUTPUT"
- name: Show docker tags
if: steps.meta.outputs.IMAGE_TAGS != ''
run: |
echo ${{ steps.meta.outputs.IMAGE_TAGS }}
25 changes: 25 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
stages:
- build

build:
stage: build
image: docker:latest
services:
- name: docker:dind
artifacts:
expire_in: 1 d
variables:
D_USER: jetsung
rules:
- changes:
- Dockerfile
- build.sh
when: manual
allow_failure: false
before_script: |
echo "$DOCKERHUB_TOKEN" | docker login "${DOCKER_REGISTRY}" -u "$DOCKERHUB_USERNAME" --password-stdin
apk --update add git curl bash
script:
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx create --use --name mybuilder
- bash build.sh
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# CHNAGELOG

- Since [46fa6a0](https://github.com/jetsung/docker-nginx-php/tree/46fa6a0f2621a4369e3f369ce165383a81115b61)

---

## 2022.01.22

Associated tags: `8.1.021, 8.0.151`

Include extensions:
`bcmath,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib`

1. The base image replaces almalinux with `ubuntu:20.04`.
2. Add `supervisor` to the image.
3. Remove extensions: `imagick,raphf,pq`
4. Add extensions: `pdo_pgsql,pgsql`

---

## 2022.01.10

Associated tags: `8.1.013, 8.0.143, 7.4.273, 7.3, 7.2`

Include extensions:
`bcmath,Core,ctype,curl,date,dom,exif,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_sqlite,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib`

1. Add extensions: `fileinfo,pq,raphf,imagick,redis`
Loading

0 comments on commit 87319b9

Please sign in to comment.