-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (96 loc) · 4.23 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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"