webman-docker/.github/workflows/docker-image.yml
meng 5d444fc763
Some checks failed
Build Docker Image And Push / Build PHP ${{ matrix.php-version }} (ubuntu-latest, 8.0) (push) Failing after 40s
test
2024-03-15 09:29:24 +08:00

60 lines
1.9 KiB
YAML

name: Build Docker Image And Push
on:
push:
tags: [ 'v*.*.*' ]
env:
PHP_EXTENSION_INSTALL_VERSION: 'latest'
COMPOSER_VERSION: 'latest'
jobs:
build:
name: Build PHP ${{ matrix.php-version }}
runs-on: ${{ matrix.os }}
container:
# 使用支持docker的act镜像
image: catthehacker/ubuntu:act-latest
volumes:
# 缓存docker构建步骤
- ubuntu_dockercache:/opt/dockercache
env:
PHP_CLI_VERSION: ${{ matrix.php-version }}-cli-alpine
strategy:
matrix:
os: [ ubuntu-latest ]
php-version: ['8.0']
max-parallel: 8
steps:
- name: Login to Git Docker Hub
# https://github.com/docker/login-action#docker-hub
uses: docker/login-action@v3
with:
registry: git.des8.com
username: ${{ secrets.HUB_USERNAME }}
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: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.HUB_PASSWORD }}
- name: Build and push
# https://github.com/docker/build-push-action
uses: build-push-action@v4
with:
context: .
file: ./Dockerfile
build-args: |
PHP_CLI_VERSION=${{ env.PHP_CLI_VERSION }}
PHP_EXTENSION_INSTALL_VERSION=${{ env.PHP_EXTENSION_INSTALL_VERSION }}
COMPOSER_VERSION=${{ env.COMPOSER_VERSION }}
push: true
tags: |
${{ secrets.HUB_USERNAME }}/webman-docker:${{ env.PHP_CLI_VERSION }}
${{ secrets.HUB_USERNAME }}/webman-docker:${{ env.PHP_CLI_VERSION }}${{ github.ref_type == 'tag' && format('-{0}', github.ref_name) || '' }}