-
Notifications
You must be signed in to change notification settings - Fork 55
165 lines (142 loc) · 5.91 KB
/
_release_docker.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: _Release 5 - Publish Docker Images to Docker Hub
on:
workflow_call:
permissions:
contents: read
packages: write
jobs:
publish-docker:
name: Build and Publish Docker Images
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3name: _Release 5 - Publish Docker Images to Docker Hub
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
publish-docker:
name: Build and Publish Docker Images
runs-on: ubuntu-latest
strategy:
matrix:
platform: [amd64, arm64]
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Extract Package and Rust Versions
id: version_extraction
run: |
PACKAGE_VERSION=$(grep -m 1 '^version' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
RUST_VERSION=$(grep -m 1 '^rust-version' Cargo.toml | sed 's/rust-version = "\(.*\)"/\1/')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "RUST_VERSION=$RUST_VERSION" >> $GITHUB_ENV
shell: bash
- name: Deactivate Private Storage
run: |
chmod +x ./scripts/deactivate_private_storage.py
./scripts/deactivate_private_storage.py
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU for multi-platform builds
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Build and push the base image with Rust version tag for each platform
- name: Build and push raphtory_base Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/base/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BASE_IMAGE=${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-${{ matrix.platform }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-${{ matrix.platform }}
# Build and push Python Docker image with package version and platform-specific tags
- name: Build and push Python Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BASE_IMAGE=${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-${{ matrix.platform }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/raphtory:${{ env.PACKAGE_VERSION }}-python-${{ matrix.platform }}
# Build and push Rust Docker image with package version and platform-specific tags
- name: Build and push Rust Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BASE_IMAGE=${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-${{ matrix.platform }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/raphtory:${{ env.PACKAGE_VERSION }}-rust-${{ matrix.platform }}
- name: Extract Package and Rust Versions
id: version_extraction
run: |
PACKAGE_VERSION=$(grep -m 1 '^version' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
RUST_VERSION=$(grep -m 1 '^rust-version' Cargo.toml | sed 's/rust-version = "\(.*\)"/\1/')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "RUST_VERSION=$RUST_VERSION" >> $GITHUB_ENV
shell: bash
- name: Deactivate Private Storage
run: |
chmod +x ./scripts/deactivate_private_storage.py
./scripts/deactivate_private_storage.py
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU for multi-platform builds
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Build and push the base image with Rust version tag for each platform
- name: Build and push raphtory_base Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/base/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-amd64
${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-arm64
# Build and push Python Docker image with package version and platform-specific tags
- name: Build and push Python Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args:
BASE_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/raphtory_base:${{ env.RUST_VERSION }}-${{ matrix.platform }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/raphtory:${{ env.PACKAGE_VERSION }}-python-amd64
${{ secrets.DOCKERHUB_USERNAME }}/raphtory:${{ env.PACKAGE_VERSION }}-python-arm64
# Build and push Rust Docker image with package version and platform-specific tags
- name: Build and push Rust Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/raphtory:${{ env.PACKAGE_VERSION }}-rust-amd64
${{ secrets.DOCKERHUB_USERNAME }}/raphtory:${{ env.PACKAGE_VERSION }}-rust-arm64