Skip to content

Workflow file for this run

name: Build, Run and Test Docker Image
on: [push]
jobs:
build-run-test:
runs-on: ubuntu-latest
strategy:
matrix:
images:
- artifact: alfresco-elasticsearch-live-indexing-metadata
version: 4.0.1
name: alfresco-enterprise-search-metadata
path: search/enterprise/common
classifier: -app.jar
group: org.alfresco
- artifact: alfresco-elasticsearch-live-indexing-path
version: 4.0.1
name: alfresco-enterprise-search-path
path: search/enterprise/common
classifier: -app.jar
group: org.alfresco
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # 3.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0
- name: Login to Docker Hub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 3.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Setup .netrc
run: |
echo "machine nexus.alfresco.com" >> ~/.netrc
echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc
- name: Fetch artifacts from nexus
run: ${{ github.workspace }}/scripts/fetch-artifact.sh ${{ matrix.images.artifact }} ${{ matrix.images.version }} ${{ matrix.images.classifier }} ${{ matrix.images.group }} ${{ matrix.images.path }}
working-directory: ${{ github.workspace }}
- name: Build Docker image
uses: docker/build-push-action@a254f8ca60a858f3136a2f1f23a60969f2c402dd # 6.4.0
with:
context: .
tags: ${{ matrix.images.name }}:test
push: false
load: true
file: ${{ github.workspace }}/${{ matrix.images.path }}/Dockerfile
- name: Run Docker image
run: docker run -d -p 8080:8080 ${{ matrix.images.name }}:test
- name: Wait for container
run: sleep 30s
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: Save Docker image
run: docker save ${{ matrix.images.name }}:test -o /tmp/${{ matrix.images.name }}.tar
- name: Upload image as a tar for next job
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4
with:
name: ${{ matrix.images.name }}-${{ github.run_number }}
path: /tmp/${{ matrix.images.name }}.tar
compose:
name: docker-compose
needs: build-run-test
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
with:
path: /tmp
pattern: "*-${{ github.run_number }}"
- name: Load Docker images
run: |
ls -1 /tmp/*.tar | xargs --no-run-if-empty -L 1 docker load -i
docker image ls -a
- name: Verify docker-compose
uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/[email protected]
timeout-minutes: 10
with:
compose_pull: false
compose_file_path: docker-compose/docker-compose.yml
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]