Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build additional PHP 8.2 images #178

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/build-job.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
178 changes: 80 additions & 98 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 14 additions & 8 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -71,8 +77,8 @@ jobs:
port 2500
from [email protected]
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
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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`.

Expand Down
4 changes: 2 additions & 2 deletions nginx-php8.2.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down