Fix path #258
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build base Docker images | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * 1' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cfg: | |
| - { PHP_VERSION: "8.5", PHP_VERSION_FPM: php85-fpm } | |
| - { PHP_VERSION: "8.4", PHP_VERSION_FPM: php84-fpm } | |
| - { PHP_VERSION: "8.3", PHP_VERSION_FPM: php83-fpm } | |
| - { PHP_VERSION: "8.2", PHP_VERSION_FPM: php82-fpm } | |
| - { PHP_VERSION: "8.1", PHP_VERSION_FPM: php81-fpm } | |
| - { PHP_VERSION: "7.4", PHP_VERSION_FPM: php74-fpm } | |
| - { PHP_VERSION: "7.3", PHP_VERSION_FPM: php73-fpm } | |
| - { PHP_VERSION: "7.2", PHP_VERSION_FPM: php72-fpm } | |
| - { PHP_VERSION: "7.1", PHP_VERSION_FPM: php71-fpm } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Step 1: Build the docker image | |
| - name: Build the Docker image | |
| run: | |
| docker build . | |
| -t michielgerritsen/magento2-base-image:${{ matrix.cfg.PHP_VERSION }} | |
| -t michielgerritsen/magento2-base-image:${{ matrix.cfg.PHP_VERSION_FPM }} | |
| -t ghcr.io/${{ github.repository }}/magento2-base-image:${{ matrix.cfg.PHP_VERSION }} | |
| -t ghcr.io/${{ github.repository }}/magento2-base-image:${{ matrix.cfg.PHP_VERSION_FPM }} | |
| --build-arg PHP_VERSION=${{ matrix.cfg.PHP_VERSION }} | |
| # Step 2: Test the docker image | |
| - name: Test that the image is working | |
| run: | | |
| docker run -v ${{ github.workspace }}/tests:/tests \ | |
| -e PHP_VERSION=${{ matrix.cfg.PHP_VERSION }} \ | |
| michielgerritsen/magento2-base-image:${{ matrix.cfg.PHP_VERSION }} \ | |
| bash -c './start-services && /tests/run-tests.sh' | |
| - name: Test Varnish support | |
| run: | | |
| docker run -v ${{ github.workspace }}/tests:/tests \ | |
| -e ENABLE_VARNISH=true \ | |
| -e PHP_VERSION=${{ matrix.cfg.PHP_VERSION }} \ | |
| michielgerritsen/magento2-base-image:${{ matrix.cfg.PHP_VERSION }} \ | |
| bash -c './start-services && /tests/run-tests.sh' | |
| # Step 3: Upload the images to Docker Hub. | |
| - name: Push the image to Docker hub | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| docker push michielgerritsen/magento2-base-image:${{ matrix.cfg.PHP_VERSION }} | |
| docker push michielgerritsen/magento2-base-image:${{ matrix.cfg.PHP_VERSION_FPM }} | |
| - name: Push the image to ghcr.io | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| docker push ghcr.io/${{ github.repository }}/magento2-base-image:${{ matrix.cfg.PHP_VERSION }} | |
| docker push ghcr.io/${{ github.repository }}/magento2-base-image:${{ matrix.cfg.PHP_VERSION_FPM }} |