diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8699663..769e47b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,7 +12,17 @@ jobs: build: name: Build PHP ${{ matrix.php-version }} 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: PHP_CLI_VERSION: ${{ matrix.php-version }}-cli-alpine strategy: @@ -21,6 +31,8 @@ jobs: php-version: ['8.0'] max-parallel: 8 steps: + - name: Checkout + uses: actions/checkout@v3 - name: Login to Git Docker Hub # https://github.com/docker/login-action#docker-hub uses: docker/login-action@v3 @@ -29,10 +41,18 @@ jobs: 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: Build and push # https://github.com/docker/build-push-action uses: docker/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 }} diff --git a/Dockerfile b/Dockerfile index 3ec1837..f0e674e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # 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 ARG PHP_EXTENSION_INSTALL_VERSION=latest # https://hub.docker.com/r/composer/composer