This commit is contained in:
meng 2024-03-14 16:57:50 +08:00
parent 0db0e48ec3
commit 2e4fc781ce
2 changed files with 22 additions and 2 deletions

View File

@ -12,7 +12,17 @@ jobs:
build: build:
name: Build PHP ${{ matrix.php-version }} name: Build PHP ${{ matrix.php-version }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
container: catthehacker/ubuntu:act-latest container:
# 使用支持docker的act镜像
image: catthehacker/ubuntu:act-latest
volumes:
# 缓存docker构建步骤
- ubuntu_dockercache:/opt/dockercache
env:
RUNNER_TOOL_CACHE: /toolcache
# 此处可修改为你任意 docker 镜像仓库地址和用户名
DOCKER_REGISTRY: git.des8.com
DOCKER_USERNAME: ${{ secrets.HUB_USERNAME }}
env: env:
PHP_CLI_VERSION: ${{ matrix.php-version }}-cli-alpine PHP_CLI_VERSION: ${{ matrix.php-version }}-cli-alpine
strategy: strategy:
@ -21,6 +31,8 @@ jobs:
php-version: ['8.0'] php-version: ['8.0']
max-parallel: 8 max-parallel: 8
steps: steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Git Docker Hub - name: Login to Git Docker Hub
# https://github.com/docker/login-action#docker-hub # https://github.com/docker/login-action#docker-hub
uses: docker/login-action@v3 uses: docker/login-action@v3
@ -29,10 +41,18 @@ jobs:
username: ${{ secrets.HUB_USERNAME }} username: ${{ secrets.HUB_USERNAME }}
password: ${{ secrets.HUB_PASSWORD }} password: ${{ secrets.HUB_PASSWORD }}
# - name: Get Meta
# id: meta
# run: |
# echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
# echo REPO_VERSION=$(echo ${{ github.ref }} | awk -F"/" '{print $3}' | awk -F"v" '{print $2}') >> $GITHUB_OUTPUT
- name: Build and push - name: Build and push
# https://github.com/docker/build-push-action # https://github.com/docker/build-push-action
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: .
file: ./Dockerfile
build-args: | build-args: |
PHP_CLI_VERSION=${{ env.PHP_CLI_VERSION }} PHP_CLI_VERSION=${{ env.PHP_CLI_VERSION }}
PHP_EXTENSION_INSTALL_VERSION=${{ env.PHP_EXTENSION_INSTALL_VERSION }} PHP_EXTENSION_INSTALL_VERSION=${{ env.PHP_EXTENSION_INSTALL_VERSION }}

View File

@ -1,5 +1,5 @@
# https://hub.docker.com/_/php # https://hub.docker.com/_/php
ARG PHP_CLI_VERSION=8.1-cli-alpine ARG PHP_CLI_VERSION=8.0-cli-alpine
# https://hub.docker.com/r/mlocati/php-extension-installer # https://hub.docker.com/r/mlocati/php-extension-installer
ARG PHP_EXTENSION_INSTALL_VERSION=latest ARG PHP_EXTENSION_INSTALL_VERSION=latest
# https://hub.docker.com/r/composer/composer # https://hub.docker.com/r/composer/composer