Skip to content

.github/workflows/build.yml #10

.github/workflows/build.yml

.github/workflows/build.yml #10

Workflow file for this run

on:
workflow_dispatch:
inputs:
dockerfileVersion:
required: true
type: string
default: 1.5.1
graphdbVersion:
required: true
type: string
latest:
required: true
type: boolean
jobs:
build-amd64:
name: Build GraphDB container image for X64/AMD64
runs-on: [self-hosted, "X64"]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get latest code
uses: actions/checkout@v3
- name: Checkout the tag
run: |
git fetch --all
git checkout v${{ inputs.dockerfileVersion }}
- name: Get GraphDB source
run: |
cd dist && wget ${{ vars.GRAPHDB_HTTP_DIR }}/graphdb-${{ inputs.graphdbVersion }}-dist.zip
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
no-cache: true
push: true
pull: true
tags: "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}_amd64"
build-args: |
GDB_VERSION=${{ inputs.graphdbVersion }}
DFILE_VERSION=${{ inputs.dockerfileVersion }}
build-arm64:
name: Build GraphDB container image for arm64
runs-on: [self-hosted, "arm64"]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get latest code
uses: actions/checkout@v3
- name: Checkout the tag
run: |
git fetch --all
git checkout v${{ inputs.dockerfileVersion }}
- name: Get GraphDB source
run: |
cd dist && wget ${{ vars.GRAPHDB_HTTP_DIR }}/graphdb-${{ inputs.graphdbVersion }}-dist.zip
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
no-cache: true
push: true
pull: true
tags: "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}_arm64"
build-args: |
GDB_VERSION=${{ inputs.graphdbVersion }}
DFILE_VERSION=${{ inputs.dockerfileVersion }}
create-manifest:
name: Creates manifest for GraphDB container image
runs-on: [self-hosted]
needs: [build-amd64, build-arm64]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create manifest with complete tag
run: |
docker manifest create "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}" "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}_amd64" "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}_arm64"
docker manifest push --purge "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}"
- name: Create manifest with short tag
run: |
docker manifest create "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.graphdbVersion }}" "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}_amd64" "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.dockerfileVersion }}-graphdb${{ inputs.graphdbVersion }}_arm64"
docker manifest push --purge "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.graphdbVersion }}"
- name: Set tag as latest
if: ${{ inputs.latest == 'true' }}
run: |
docker pull "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.graphdbVersion }}"
docker tag "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:${{ inputs.graphdbVersion }}" "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:latest"
docker push "${{ vars.DOCKERHUB_REPOSITORY_NAME }}:latest"