Skip to content

Commit

Permalink
Merge pull request #6 from filviu/PR-build
Browse files Browse the repository at this point in the history
setup workflow to build on prs
  • Loading branch information
filviu authored Mar 4, 2024
2 parents 7f3497b + dce826d commit 86135ac
Showing 1 changed file with 117 additions and 113 deletions.
230 changes: 117 additions & 113 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,115 +1,119 @@
---

name: Build and Push Docker Images

on:
# Allows you to run workflow manually from Actions tab
workflow_dispatch:
push:
branches: [main,master]

jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
matrix:
mq_version:
- 5.12.1
- 5.12.2
- 5.13.0
- 5.13.1
- 5.13.2
- 5.13.3
- 5.13.4
- 5.14.0
- 5.14.0-alpine
- 5.14.1
- 5.14.1-alpine
- 5.14.2
- 5.14.2-alpine
- 5.14.3
- 5.14.3-alpine
- 5.14.4
- 5.14.4-alpine
- 5.14.5
- 5.14.5-alpine
- 5.15.2
- 5.15.2-alpine
- 5.15.3
- 5.15.3-alpine
- 5.15.4
- 5.15.4-alpine
- 5.15.5
- 5.15.5-alpine
- 5.15.6
- 5.15.6-alpine
- 5.15.9
- 5.15.9-alpine
- 5.15.13
- 5.15.13-alpine
- 5.15.14
- 5.15.14-alpine
- 5.15.15
- 5.15.15-alpine
- 5.15.16
- 5.15.16-alpine
- 5.16.5
- 5.16.5-alpine
- 5.16.7
- 5.16.7-alpine
- 5.17.3
- 5.17.3-alpine
- 5.17.6
- 5.17.6-alpine
- 5.18.3
- 5.18.3-alpine
steps:
- name: Check out
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build image
uses: docker/build-push-action@v3
with:
tags: filviu/activemq:${{ matrix.mq_version }}
context: ./${{ matrix.mq_version }}
platforms: linux/amd64
push: false
load: true
cache-from: type=gha,scope=${{ matrix.mq_version }}
cache-to: type=gha,mode=max,scope=${{ matrix.mq_version }}

- name: Test the image
shell: bash
run: |
docker run -d -p 8161:8161 --expose 8161 --name activemq-test-${{ matrix.mq_version }} filviu/activemq:${{ matrix.mq_version }}
wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 10 -O /dev/null http://admin:[email protected]:8161/admin/
docker stop activemq-test-${{ matrix.mq_version }}
docker rm activemq-test-${{ matrix.mq_version }}
- name: Build & push image
uses: docker/build-push-action@v3
with:
tags: filviu/activemq:${{ matrix.mq_version }}
context: ./${{ matrix.mq_version }}
platforms: linux/amd64
push: true
cache-from: type=gha,scope=${{ matrix.mq_version }}
cache-to: type=gha,mode=max,scope=${{ matrix.mq_version }}
name: Build and Push Docker Images

on:
# Allows you to run workflow manually from Actions tab
workflow_dispatch:
push:
branches: [main,master]
pull_request:
branches: [ "main","master" ]

jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
matrix:
mq_version:
- 5.12.1
- 5.12.2
- 5.13.0
- 5.13.1
- 5.13.2
- 5.13.3
- 5.13.4
- 5.14.0
- 5.14.0-alpine
- 5.14.1
- 5.14.1-alpine
- 5.14.2
- 5.14.2-alpine
- 5.14.3
- 5.14.3-alpine
- 5.14.4
- 5.14.4-alpine
- 5.14.5
- 5.14.5-alpine
- 5.15.2
- 5.15.2-alpine
- 5.15.3
- 5.15.3-alpine
- 5.15.4
- 5.15.4-alpine
- 5.15.5
- 5.15.5-alpine
- 5.15.6
- 5.15.6-alpine
- 5.15.9
- 5.15.9-alpine
- 5.15.13
- 5.15.13-alpine
- 5.15.14
- 5.15.14-alpine
- 5.15.15
- 5.15.15-alpine
- 5.15.16
- 5.15.16-alpine
- 5.16.5
- 5.16.5-alpine
- 5.16.7
- 5.16.7-alpine
- 5.17.3
- 5.17.3-alpine
- 5.17.6
- 5.17.6-alpine
- 5.18.3
- 5.18.3-alpine
steps:
- name: Check out
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build image
uses: docker/build-push-action@v3
with:
tags: filviu/activemq:${{ matrix.mq_version }}
context: ./${{ matrix.mq_version }}
platforms: linux/amd64
push: false
load: true
cache-from: type=gha,scope=${{ matrix.mq_version }}
cache-to: type=gha,mode=max,scope=${{ matrix.mq_version }}

- name: Test the image
shell: bash
run: |
docker run -d -p 8161:8161 --expose 8161 --name activemq-test-${{ matrix.mq_version }} filviu/activemq:${{ matrix.mq_version }}
wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 10 -O /dev/null http://admin:[email protected]:8161/admin/
docker stop activemq-test-${{ matrix.mq_version }}
docker rm activemq-test-${{ matrix.mq_version }}
- name: Build & push image
if: github.event_name == 'push'
uses: docker/build-push-action@v3
with:
tags: filviu/activemq:${{ matrix.mq_version }}
context: ./${{ matrix.mq_version }}
platforms: linux/amd64
push: true
cache-from: type=gha,scope=${{ matrix.mq_version }}
cache-to: type=gha,mode=max,scope=${{ matrix.mq_version }}

0 comments on commit 86135ac

Please sign in to comment.