-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d4db23
commit 12c5ff5
Showing
71 changed files
with
2,007 additions
and
262 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,266 @@ | ||
name: Lagoon Image Build - buildx | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'testing/docker_buildx**' | ||
pull_request: | ||
branches: | ||
- 'testing/docker_buildx**' | ||
|
||
jobs: | ||
changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
# Expose matched filters as job 'package_group' output variable | ||
package_group: ${{ steps.filter.outputs.changes }} | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
mariadb: | ||
- 'images/mariadb/**' | ||
- '!images/**' | ||
node: | ||
- 'images/node/**' | ||
- '!images/**' | ||
php: | ||
- 'images/php/**' | ||
- '!images/**' | ||
postgres: | ||
- 'images/postgres/**' | ||
- '!images/**' | ||
python: | ||
- 'images/python/**' | ||
- '!images/**' | ||
redis: | ||
- 'images/redis/**' | ||
- '!images/**' | ||
ruby: | ||
- 'images/ruby/**' | ||
- '!images/**' | ||
solr: | ||
- 'images/solr/**' | ||
- '!images/**' | ||
varnish: | ||
- 'images/varnish/**' | ||
- '!images/**' | ||
others: | ||
- 'images/commons/**' | ||
- 'images/elasticsearch-7/**' | ||
- 'images/kibana-7/**' | ||
- 'images/logstash-7/**' | ||
- 'images/mongo-4/**' | ||
- 'images/nginx/**' | ||
- 'images/nginx-drupal/**' | ||
- 'images/opensearch-2/**' | ||
- 'images/rabbitmq/**' | ||
- 'images/rabbitmq-cluster/**' | ||
- '!images/**' | ||
build: | ||
needs: changes | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package_group: ${{ fromJSON(needs.changes.outputs.package_group) }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
# - | ||
# name: Restore docker cache | ||
# id: cache-packages-restore | ||
# uses: actions/cache/restore@v3 | ||
# with: | ||
# path: | | ||
# /tmp/.buildx-cache | ||
# key: ${{ runner.os }}-buildx-${{ matrix.package_group }} | ||
- | ||
name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ matrix.package_group }}-${{ hashFiles('**/images') }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
# - | ||
# name: Login to DockerHub | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build | ||
uses: docker/bake-action@v4 | ||
with: | ||
files: | | ||
./docker-bake.hcl | ||
targets: ${{ matrix.package_group }} | ||
push: true | ||
# set: | | ||
# *.cache-from=type=gha | ||
# *.cache-to=type=gha,mode=max | ||
set: | | ||
*.cache-from=type=local,src=/tmp/.buildx-cache | ||
*.cache-to=type=local,dest=/tmp/.buildx-cache-new | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
# - | ||
# name: Save docker cache | ||
# uses: actions/cache/save@v3 | ||
# with: | ||
# path: | | ||
# /tmp/.buildx-cache | ||
# key: ${{ runner.os }}-buildx-${{ matrix.package_group }}-${{ hashFiles('**/images') }} | ||
# - | ||
# name: Build and push | ||
# uses: docker/build-push-action@v5 | ||
# with: | ||
# context: ${{ matrix.context }} | ||
# file: ${{ matrix.context }}/${{ matrix.dockerfile }} | ||
# platforms: linux/amd64,linux/arm64 | ||
# push: true | ||
# tags: ${{ steps.meta.outputs.tags }} | ||
# labels: ${{ steps.meta.outputs.labels }} | ||
# cache-from: | | ||
# type=registry,ref=docker.io/testlagoon/${{ matrix.image_name }}:main | ||
# type=registry,ref=ghcr.io/tobybellwood/${{ matrix.image_name }}:${{ github.ref_name }} | ||
# type=gha | ||
# cache-to: | | ||
# type=gha,mode=max | ||
# build-args: | | ||
# IMAGE_REPO=ghcr.io/${{ github.repository_owner }} | ||
# IMAGE_TAG=${{ github.ref_name }} | ||
# BUILDKIT_INLINE_CACHE=1 | ||
# - | ||
# uses: anchore/sbom-action@v0 | ||
# with: | ||
# image: ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.ref_name }} | ||
# artifact-name: ${{ matrix.image_name }}.cyclonedx | ||
# format: cyclonedx | ||
# - | ||
# name: view SBOM | ||
# run: | | ||
# cat /tmp/sbom-action-*/${{ matrix.image_name }}.cyclonedx | ||
|
||
# app_test: | ||
# runs-on: ubuntu-latest | ||
# needs: build | ||
# defaults: | ||
# run: | ||
# working-directory: ./tests | ||
# steps: | ||
# - | ||
# name: Checkout | ||
# uses: actions/checkout@v4 | ||
# - | ||
# name: Checkout | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# repository: uselagoon/lagoon-examples | ||
# path: tests | ||
# - | ||
# name: Add additional tests | ||
# run: | | ||
# git submodule add -b php74 https://github.com/lagoon-examples/drupal9-postgres drupal9-postgres-php74 | ||
# git submodule add -b php81 https://github.com/lagoon-examples/drupal9-base drupal9-base-php81 | ||
# - | ||
# name: Update git submodules | ||
# run: | | ||
# git submodule sync | ||
# git submodule update --init | ||
# - | ||
# name: Use built images to test | ||
# run: | | ||
# grep -rl uselagoon . | xargs sed -i '/^FROM/ s#latest#${{ github.ref_name }}#' | ||
# grep -rl uselagoon . | xargs sed -i '/^FROM/ s#uselagoon#ghcr.io/${{ github.repository_owner }}#' | ||
# grep -rl uselagoon . | xargs sed -i '/image:/ s#latest#${{ github.ref_name }}#' | ||
# grep -rl uselagoon . | xargs sed -i '/image:/ s#uselagoon#ghcr.io/${{ github.repository_owner }}#' | ||
# find . -maxdepth 2 -name docker-compose.yml | xargs sed -i -e '/###/d' | ||
# - | ||
# name: check replacements | ||
# run: | | ||
# find . -maxdepth 2 -name docker-compose.yml | xargs grep image: | ||
# find . -maxdepth 3 -name *.dockerfile | xargs grep ^FROM | ||
# - | ||
# name: Install test harness | ||
# run: | | ||
# yarn install | ||
# - | ||
# name: Generate test files | ||
# run: | | ||
# yarn generate-tests | ||
# - | ||
# name: Run docker-compose tests | ||
# run: | | ||
# yarn test:dockercompose | ||
|
||
# image_test: | ||
# runs-on: ubuntu-latest | ||
# needs: build | ||
# defaults: | ||
# run: | ||
# working-directory: ./tests | ||
# steps: | ||
# - | ||
# name: Checkout | ||
# uses: actions/checkout@v4 | ||
# - | ||
# name: Checkout | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# repository: uselagoon/lagoon-examples | ||
# path: tests | ||
# - | ||
# name: Add additional tests | ||
# run: | | ||
# mkdir -p ./all-images && cp ../helpers/docker-compose.yml ./all-images/ && cp ../helpers/TESTING_dockercompose.md ./all-images/ | ||
# - | ||
# name: Use built images to test | ||
# run: | | ||
# grep -rl uselagoon . | xargs sed -i '/image:/ s#latest#${{ github.ref_name }}#' | ||
# grep -rl uselagoon . | xargs sed -i '/image:/ s#uselagoon#ghcr.io/${{ github.repository_owner }}#' | ||
# find . -maxdepth 2 -name docker-compose.yml | xargs sed -i -e '/###/d' | ||
# - | ||
# name: check replacements | ||
# run: | | ||
# find . -maxdepth 2 -name docker-compose.yml | xargs cat | ||
# - | ||
# name: check dc builds | ||
# run: | | ||
# cd ./all-images | ||
# docker-compose up -d | ||
# docker-compose logs | ||
# - | ||
# name: Install test harness | ||
# run: | | ||
# yarn install | ||
# - | ||
# name: Generate test files | ||
# run: | | ||
# yarn generate-tests | ||
# - | ||
# name: Run docker-compose tests | ||
# run: | | ||
# yarn test:dockercompose |
Oops, something went wrong.