diff --git a/.github/workflows/build-job.yaml b/.github/workflows/build-job.yaml new file mode 100644 index 0000000..3a22168 --- /dev/null +++ b/.github/workflows/build-job.yaml @@ -0,0 +1,45 @@ +name: Build job +on: + workflow_call: + inputs: + dockerfile: + description: Path to the Dockerfile to build + required: true + type: string + tags: + description: Tags to apply to the image + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + show-progress: false + + # See https://github.com/docker/setup-qemu-action + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + # See https://github.com/docker/setup-buildx-action + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + # See https://github.com/docker/login-action + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + # Build Apache httpd images + - name: Build and push experimental image + if: github.event_name == 'push' + uses: docker/build-push-action@v2 + with: + file: ${{ inputs.dockerfile }} + platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/386 + push: true + tags: ${{ inputs.tags }} diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 9778db5..2a5ee70 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -17,108 +17,90 @@ on: - published jobs: - build_apache: - name: Build Apache variant + parse_release_tag: + if: github.event_name == 'release' runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - show-progress: false - - # See https://github.com/docker/setup-qemu-action - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - # See https://github.com/docker/setup-buildx-action - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - # See https://github.com/docker/login-action - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - # Build Apache httpd images - - name: Build and push experimental image - if: github.event_name == 'push' - uses: docker/build-push-action@v2 - with: - file: apache.dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/386 - push: true - tags: | - ckulka/baikal:experimental-apache - ckulka/baikal:experimental - - # Get the release version by stripping build metadata from the release name - - name: Parse release tag - id: parse-release-tag - if: github.event_name == 'release' - run: echo tag=${GITHUB_REF_NAME/+*/} >> "$GITHUB_OUTPUT" - - - name: Build and push release image - if: github.event_name == 'release' - uses: docker/build-push-action@v2 - with: - file: apache.dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/386 - push: true - tags: | - ckulka/baikal:${{ steps.parse-release-tag.outputs.tag }}-apache - ckulka/baikal:${{ steps.parse-release-tag.outputs.tag }} - ckulka/baikal:apache - ckulka/baikal:latest - - build_nginx: - name: Build nginx variant - runs-on: ubuntu-latest - + outputs: + tag: ${{ steps.parse-release-tag.outputs.tag }} steps: - - uses: actions/checkout@v4 - with: - show-progress: false - - # See https://github.com/docker/setup-qemu-action - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - # See https://github.com/docker/setup-buildx-action - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - # See https://github.com/docker/login-action - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - # Build nginx images - - name: Build and push experimental image - if: github.event_name == 'push' - uses: docker/build-push-action@v2 - with: - file: nginx.dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/386 - push: true - tags: ckulka/baikal:experimental-nginx - # Get the release version by stripping build metadata from the release name - name: Parse release tag id: parse-release-tag - if: github.event_name == 'release' run: echo tag=${GITHUB_REF_NAME/+*/} >> "$GITHUB_OUTPUT" - - name: Build and push release image - if: github.event_name == 'release' - uses: docker/build-push-action@v2 - with: - file: nginx.dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/386 - push: true - tags: | - ckulka/baikal:${{ steps.parse-release-tag.outputs.tag }}-nginx - ckulka/baikal:nginx + apache_experimental: + name: Apache (experimental) + if: github.event_name == 'push' + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: apache.dockerfile + tags: | + ckulka/baikal:experimental-apache + ckulka/baikal:experimental + + apache_release: + name: Apache (release) + needs: parse_release_tag + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: apache.dockerfile + tags: | + ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-apache + ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }} + ckulka/baikal:apache + ckulka/baikal:latest + + apache_experimental_php82: + name: Apache + PHP 8.2 (experimental) + if: github.event_name == 'push' + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: apache-php8.2.dockerfile + tags: | + ckulka/baikal:experimental-apache-php8.2 + ckulka/baikal:experimental-php8.2 + + apache_release_php82: + name: Apache + PHP 8.2 (release) + needs: parse_release_tag + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: apache-php8.2.dockerfile + tags: | + ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-apache-php8.2 + ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-php8.2 + ckulka/baikal:apache-php8.2 + + nginx_experimental: + name: Nginx (experimental) + if: github.event_name == 'push' + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: nginx.dockerfile + tags: ckulka/baikal:experimental-nginx + + nginx_release: + name: Apache (release) + needs: parse_release_tag + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: nginx.dockerfile + tags: | + ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-nginx + ckulka/baikal:nginx + + nginx_experimental_php82: + name: Apache + PHP 8.2 (experimental) + if: github.event_name == 'push' + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: nginx-php8.2.dockerfile + tags: ckulka/baikal:experimental-nginx-php8.2 + + nginx_release_php82: + name: Apache + PHP 8.2 (release) + needs: parse_release_tag + uses: ./.github/workflows/build-job.yaml + with: + dockerfile: nginx-php8.2.dockerfile + tags: ckulka/baikal:${{ needs.parse_release_tag.outputs.tag }}-nginx-php8.2 diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index b3c2920..7266562 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -18,6 +18,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: package.json + cache: npm - name: Install Cypress dependencies run: npm ci @@ -31,7 +32,11 @@ jobs: strategy: fail-fast: true matrix: - dockerfile: [apache, nginx] + dockerfile: + - apache + - apache-php8.2 + - nginx + - nginx-php8.2 steps: - uses: actions/checkout@v4 @@ -41,16 +46,17 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: package.json + cache: npm - name: Install Cypress dependencies run: npm ci - - name: Build Baikal image + - name: Build Docker image id: build - run: echo "IMAGE_ID=$(docker build -qf ${{ matrix.dockerfile }}.dockerfile .)" >> "$GITHUB_OUTPUT" + run: docker build -f ${{ matrix.dockerfile }}.dockerfile -t baikal-image . - name: Start Baikal container - run: docker run --rm -dp 80:80 --name ${{ matrix.dockerfile }} ${{ steps.build.outputs.IMAGE_ID }} + run: docker run --rm -dp 80:80 --name ${{ matrix.dockerfile }} baikal-image - name: Run Cypress tests run: npm run test @@ -60,8 +66,8 @@ jobs: - name: Build and run MailSlurper run: | - IMAGE_ID=$(docker build -q 'https://github.com/mailslurper/mailslurper.git#release-1.15.0') - docker run --rm --detach --name mailslurper -p 8085:8085 -v ${{ github.workspace }}/cypress/fixtures/mailslurper-config.json:/config.json:ro $IMAGE_ID + docker build -q 'https://github.com/mailslurper/mailslurper.git#release-1.15.0' -t mailslurper + docker run --rm --detach --name mailslurper -p 8085:8085 -v ${{ github.workspace }}/cypress/fixtures/mailslurper-config.json:/config.json:ro mailslurper - name: Start Baikal container with MSMTP configuration env: @@ -71,8 +77,8 @@ jobs: port 2500 from baikal@example.com run: | - docker run --rm --detach -p 80:80 -e MSMTPRC="$MSMTPRC" --link mailslurper --name ${{ matrix.dockerfile }} ${{ steps.build.outputs.IMAGE_ID }} - docker cp ${{ github.workspace }}/cypress/fixtures/mail-test.php ${{ matrix.dockerfile }}:/var/www/baikal/html/ + docker run --rm --detach -p 80:80 -e MSMTPRC="$MSMTPRC" --link mailslurper --name baikal baikal-image + docker cp ${{ github.workspace }}/cypress/fixtures/mail-test.php baikal:/var/www/baikal/html/ - name: Run Cypress tests incl. MSMTP run: CYPRESS_MSMTP_ENABLED=TRUE npm run test diff --git a/README.md b/README.md index 1d07950..35925c5 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ I follow the same version naming scheme as [Baikal](http://sabre.io/baikal/) the The following tags support multiple architectures, e.g. `amd64`, `arm32v7`, `arm64v8` and `i386`. -- [`0.9.5`, `0.9.5-apache`, `apache`, `latest`](https://github.com/ckulka/baikal-docker/blob/0.9.5+msmtpfix/apache.dockerfile) -- [`0.9.5-nginx`, `nginx`](https://github.com/ckulka/baikal-docker/blob/0.9.5+msmtpfix/nginx.dockerfile) -- [`0.9.5-apache-php8.2`, `apache-php8.2`, `0.9.5-php8.2`](https://github.com/ckulka/baikal-docker/blob/0.9.5+msmtp/apache-php8.2.dockerfile) -- [`0.9.5-nginx-php8.2`, `nginx-php8.2`](https://github.com/ckulka/baikal-docker/blob/0.9.5+msmtpfix/nginx-php8.2.dockerfile) +- [`0.9.5`, `0.9.5-apache`, `apache`, `latest`](https://github.com/ckulka/baikal-docker/blob/0.9.5/apache.dockerfile) +- [`0.9.5-apache-php8.2`, `apache-php8.2`, `0.9.5-php8.2`](https://github.com/ckulka/baikal-docker/blob/0.9.5/apache-php8.2.dockerfile) +- [`0.9.5-nginx`, `nginx`](https://github.com/ckulka/baikal-docker/blob/0.9.5/nginx.dockerfile) +- [`0.9.5-nginx-php8.2`, `nginx-php8.2`](https://github.com/ckulka/baikal-docker/blob/0.9.5/nginx-php8.2.dockerfile) - [`0.9.4`, `0.9.4-apache`](https://github.com/ckulka/baikal-docker/blob/0.9.4+msmtpfix/apache.dockerfile) - [`0.9.4-php8.0`, `0.9.4-apache-php8.0`, `apache-php8.0`, `latest-php8.0`](https://github.com/ckulka/baikal-docker/blob/0.9.4+msmtpfix/apache-php8.0.dockerfile) - [`0.9.4-nginx`](https://github.com/ckulka/baikal-docker/blob/0.9.4+msmtpfix/nginx.dockerfile) @@ -34,8 +34,6 @@ The following tags support multiple architectures, e.g. `amd64`, `arm32v7`, `arm - [`0.9.1-nginx-php8.0`](https://github.com/ckulka/baikal-docker/blob/0.9.1/nginx-php8.0.dockerfile) - [`0.9.0`, `0.9.0-apache`](https://github.com/ckulka/baikal-docker/blob/0.9.0/apache.dockerfile) - [`0.9.0-nginx`](https://github.com/ckulka/baikal-docker/blob/0.9.0/nginx.dockerfile) -- [`0.8.0`, `0.8.0-apache`](https://github.com/ckulka/baikal-docker/blob/0.8.0/apache.dockerfile) -- [`0.8.0-nginx`](https://github.com/ckulka/baikal-docker/blob/0.8.0/nginx.dockerfile) For earlier versions all the way back to version 0.2.7, please search in the [tags](https://hub.docker.com/r/ckulka/baikal/tags) tab. Version 0.4.5 and older are only available for `amd64`. Version 0.9.0 and older do not support `i386`. diff --git a/nginx-php8.2.dockerfile b/nginx-php8.2.dockerfile index 852e9d1..9cfef4d 100644 --- a/nginx-php8.2.dockerfile +++ b/nginx-php8.2.dockerfile @@ -31,8 +31,8 @@ RUN curl -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg sqlite3 \ msmtp msmtp-mta &&\ rm -rf /var/lib/apt/lists/* &&\ - sed -i 's/www-data/nginx/' /etc/php/8.1/fpm/pool.d/www.conf &&\ - sed -i 's/^listen = .*/listen = \/var\/run\/php-fpm.sock/' /etc/php/8.1/fpm/pool.d/www.conf + sed -i 's/www-data/nginx/' /etc/php/8.2/fpm/pool.d/www.conf &&\ + sed -i 's/^listen = .*/listen = \/var\/run\/php-fpm.sock/' /etc/php/8.2/fpm/pool.d/www.conf # Add Baikal & nginx configuration COPY files/docker-entrypoint.d/*.sh files/docker-entrypoint.d/nginx/ /docker-entrypoint.d/