diff options
Diffstat (limited to 'docker/build.sh')
-rwxr-xr-x | docker/build.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 00000000..76970617 --- /dev/null +++ b/docker/build.sh | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | ||
4 | # | ||
5 | # SPDX-License-Identifier: EPL-2.0 | ||
6 | |||
7 | set -euo pipefail | ||
8 | |||
9 | (cd .. && ./gradlew :refinery-language-web:distTar) | ||
10 | |||
11 | refinery_version="$(grep '^version=' ../gradle.properties | cut -d'=' -f2)" | ||
12 | distribution_name="refinery-language-web-${refinery_version}" | ||
13 | rm -rf "${distribution_name}" dist app_lib app_{amd64,arm64}_bin lib lib_{amd64,arm64} | ||
14 | |||
15 | tar -xf "../subprojects/language-web/build/distributions/${distribution_name}.tar" | ||
16 | mv "${distribution_name}" dist | ||
17 | mkdir -p app_lib app_{amd64,arm64}_bin lib lib_{amd64,arm64} | ||
18 | |||
19 | # Move architecture-specific jars to their repsective directories. | ||
20 | mv dist/lib/ortools-linux-x86-64-*.jar lib_amd64 | ||
21 | mv dist/lib/ortools-linux-aarch64-*.jar lib_arm64 | ||
22 | rm dist/lib/ortools-{darwin,win32}-*.jar | ||
23 | # Move the applications jars for the dependencies into a separate Docker layer | ||
24 | # to enable faster updates. | ||
25 | mv dist/lib/refinery-* app_lib | ||
26 | mv dist/lib/* lib | ||
27 | # Omit references to jars not present for the current architecture from the | ||
28 | # startup scripts. | ||
29 | sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-aarch64\)[^:]\+\.jar//g' dist/bin/refinery-language-web > app_amd64_bin/refinery-language-web | ||
30 | sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-x86-64\)[^:]\+\.jar//g' dist/bin/refinery-language-web > app_arm64_bin/refinery-language-web | ||
31 | chmod a+x app_{amd64,arm64}_bin/refinery-language-web | ||
32 | rm -rf dist | ||
33 | |||
34 | docker buildx build . \ | ||
35 | --platform linux/amd64,linux/arm64 \ | ||
36 | --output "type=image,name=ghcr.io/graphs4value/refinery:${refinery_version},name=ghcr.io/graphs4value/refinery:latest,push=true,annotation-index.org.opencontainers.image.source=https://github.com/graphs4value/refinery,annotation-index.org.opencontainers.image.description=Refinery: an efficient graph solver for generating well-formed models,annotation-index.org.opencontainers.image.licenses=EPL-2.0" \ | ||
37 | --label 'org.opencontainers.image.source=https://github.com/graphs4value/refinery' \ | ||
38 | --label 'org.opencontainers.image.description=Refinery: an efficient graph solver for generating well-formed models' \ | ||
39 | --label 'org.opencontainers.image.licenses=EPL-2.0' | ||