diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31e8bbc..a61908e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,20 @@ env: jobs: build_latest: runs-on: ubuntu-latest - env: - TAG: php8 + strategy: + matrix: + tag: [php8, php7.1] + include: + - tag: php8 + buildArgs: "" + tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ matrix.tag }} + + - tag: php7.1 + buildArgs: | + PHP_VERSION=7.1 + DEPLOYER_VERSION=v6.6.0 + COMPOSER_VERSION=2.2.18 + tags: ${{ env.IMAGE }}:${{ matrix.tag }} steps: - uses: actions/checkout@v2 @@ -25,7 +37,7 @@ jobs: - name: Login to Docker Hub id: docker_login - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} @@ -38,40 +50,7 @@ jobs: pull: true push: true platforms: linux/amd64,linux/arm64,linux/arm/v7 - cache-from: ${{ env.IMAGE }}:${{ env.TAG }} + cache-from: ${{ env.IMAGE }}:${{ matrix.tag }} cache-to: type=inline - tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ env.TAG }} - - - build_71: - runs-on: ubuntu-latest - env: - TAG: php7.1 - steps: - - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - id: docker_login - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - - - name: Build 7.1 and push - id: docker_build - uses: docker/build-push-action@v3 - with: - context: . - pull: true - push: true - platforms: linux/amd64,linux/arm64,linux/arm/v7 - cache-from: ${{ env.IMAGE }}:${{ env.TAG }} - cache-to: type=inline - build-args: | - PHP_VERSION=7.1 - DEPLOYER_VERSION=v6.6.0 - COMPOSER_VERSION=2.2.18 - tags: ${{ env.IMAGE }}:${{ env.TAG }} + build-args: ${{ matrix.buildArgs }} + tags: ${{ matrix.tags }} diff --git a/Dockerfile b/Dockerfile index 8d88994..57a538a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,10 +73,23 @@ RUN \ && chmod +x /usr/local/bin/dep +# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope +ARG TARGETARCH + # Install node, npm and yarn -ARG NODE_VERSION="v16.17.0" +ARG NODE_VERSION="v16.17.1" RUN \ - curl -L "https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.xz" \ + if [ "${TARGETARCH}" = "amd64" ]; then \ + ARCHITECTURE=x64; \ + elif [ "${TARGETARCH}" = "arm" ]; then \ + ARCHITECTURE=armv7l; \ + elif [ "${TARGETARCH}" = "arm64" ]; then \ + ARCHITECTURE=arm64; \ + else \ + echo "Unknown TARGETARCH: '${TARGETARCH}'";\ + exit 1; \ + fi \ + && curl -L "https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${ARCHITECTURE}.tar.xz" \ --output node.tar.xz \ && tar xJf node.tar.xz -C /usr --strip-components=1 --no-same-owner \ && rm node.tar.xz \