Skip to content

feat: build non-root image variants #86

feat: build non-root image variants

feat: build non-root image variants #86

Workflow file for this run

name: Build & Test
permissions:
contents: read
on:
pull_request: {}
push:
branches:
- '!master'
jobs:
build-and-testvariants:
name: Build image variants and run tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
include:
- variant: 'apache'
test-files: 'apache-postgres'
docker-tag: roundcube/roundcubemail:test-apache
target: 'root'
- variant: 'fpm'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:test-fpm
target: 'root'
- variant: 'fpm-alpine'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:test-fpm-alpine
target: 'root'
- variant: 'apache'
test-files: 'apache-postgres'
docker-tag: roundcube/roundcubemail:test-apache-nonroot
target: 'nonroot'
http-port: '8000'
- variant: 'fpm'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:test-fpm-nonroot
target: 'nonroot'
- variant: 'fpm-alpine'
test-files: 'fpm-postgres'
docker-tag: roundcube/roundcubemail:test-fpm-alpine-nonroot
target: 'nonroot'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get docker hub username
id: creds
run: echo '::set-output name=username::${{ secrets.DOCKER_PULL_USERNAME }}'
- name: Login to Docker Hub
if: steps.creds.outputs.username != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_PULL_USERNAME }}
password: ${{ secrets.DOCKER_PULL_PASSWORD }}
- name: Build image for "${{ matrix.variant }} / ${{ matrix.target }}"
run: cd ${{ matrix.variant }} && docker buildx build ./ -t ${{ matrix.docker-tag }} --target ${{ matrix.target }}
- name: Run tests
env:
ROUNDCUBEMAIL_TEST_IMAGE: ${{ matrix.docker-tag }}
HTTP_PORT: ${{ matrix.http-port || '80' }}
run: |
set -exu;
for testFile in ${{ join(matrix.test-files, ' ') }};
do
docker compose -f ./tests/docker-compose.test-${testFile}.yml \
up --exit-code-from=sut --abort-on-container-exit
done