-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: create Docker images automatically
- Loading branch information
Showing
11 changed files
with
241 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
context/extracted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/> | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
set -euo pipefail | ||
|
||
REFINERY_VERSION="$(./get_version.sh)" | ||
export REFINERY_VERSION | ||
|
||
export REFINERY_PUSH="${1-false}" | ||
|
||
export SOURCE_DATE_EPOCH=0 | ||
|
||
cd context | ||
exec docker buildx bake -f docker-bake.hcl "${@:2}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2023-2024 The Refinery Authors <https://refinery.tools/> | ||
# SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/> | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
set -euo pipefail | ||
|
||
(cd .. && ./gradlew distTar) | ||
|
||
refinery_version="$(grep '^version=' ../gradle.properties | cut -d'=' -f2)" | ||
cli_distribution_name="refinery-generator-cli-${refinery_version}" | ||
web_distribution_name="refinery-language-web-${refinery_version}" | ||
./prepare_context.sh | ||
|
||
rm -rf "${cli_distribution_name}" "${web_distribution_name}" {cli,web}_dist \ | ||
{cli,web}_{,app_}lib common_{,amd64_,arm64_}lib {cli,web}_{amd64,arm64}_bin | ||
|
||
tar -xf "../subprojects/generator-cli/build/distributions/${cli_distribution_name}.tar" | ||
mv "${cli_distribution_name}" cli_dist | ||
tar -xf "../subprojects/language-web/build/distributions/${web_distribution_name}.tar" | ||
mv "${web_distribution_name}" web_dist | ||
mkdir -p {cli,web}_{,app_}lib common_{,amd64_,arm64_}lib {cli,web}_{amd64,arm64}_bin | ||
|
||
# Our application itself is very small, so it will get added as the last layer | ||
# of both containers. | ||
mv cli_dist/lib/refinery-* cli_app_lib | ||
mv web_dist/lib/refinery-* web_app_lib | ||
|
||
for i in cli_dist/lib/*; do | ||
j="web${i#cli}" | ||
if [[ -f "$j" ]]; then | ||
mv "$i" "common_lib${i#cli_dist/lib}" | ||
rm "$j" | ||
fi | ||
done | ||
|
||
# Move architecture-specific jars to their repsective directories. | ||
mv common_lib/ortools-linux-x86-64-*.jar common_amd64_lib | ||
mv common_lib/ortools-linux-aarch64-*.jar common_arm64_lib | ||
rm common_lib/ortools-{darwin,win32}-*.jar | ||
# Move the applications jars for the dependencies into a separate Docker layer | ||
# to enable faster updates. | ||
mv cli_dist/lib/* cli_lib | ||
mv web_dist/lib/* web_lib | ||
# Omit references to jars not present for the current architecture from the | ||
# startup scripts. | ||
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-aarch64\)[^:]\+\.jar//g' cli_dist/bin/refinery-generator-cli > cli_amd64_bin/refinery-generator-cli | ||
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-x86-64\)[^:]\+\.jar//g' cli_dist/bin/refinery-generator-cli > cli_arm64_bin/refinery-generator-cli | ||
chmod a+x cli_{amd64,arm64}_bin/refinery-generator-cli | ||
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-aarch64\)[^:]\+\.jar//g' web_dist/bin/refinery-language-web > web_amd64_bin/refinery-language-web | ||
sed 's/:\$APP_HOME\/lib\/ortools-\(darwin\|win32\|linux-x86-64\)[^:]\+\.jar//g' web_dist/bin/refinery-language-web > web_arm64_bin/refinery-language-web | ||
chmod a+x web_{amd64,arm64}_bin/refinery-language-web | ||
rm -rf {cli,web}_dist | ||
|
||
REFINERY_VERSION="${refinery_version}" docker buildx bake -f docker-bake.hcl | ||
./bake.sh "${1-false}" "${@:2}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/> | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
variable "REFINERY_VERSION" { | ||
default = "" | ||
} | ||
|
||
variable "REFINERY_PUSH" { | ||
default = "false" | ||
} | ||
|
||
group "default" { | ||
targets = ["cli", "web"] | ||
} | ||
|
||
target "base" { | ||
dockerfile = "Dockerfile.base" | ||
platforms = ["linux/amd64", "linux/arm64"] | ||
output = ["type=cacheonly"] | ||
} | ||
|
||
target "cli" { | ||
dockerfile = "Dockerfile.cli" | ||
platforms = ["linux/amd64", "linux/arm64"] | ||
output = [ | ||
"type=image,push=${REFINERY_PUSH},\"name=ghcr.io/graphs4value/refinery-cli:${REFINERY_VERSION},ghcr.io/graphs4value/refinery-cli:latest\",annotation-index.org.opencontainers.image.source=https://github.com/graphs4value/refinery,\"annotation-index.org.opencontainers.image.description=Command line interface for Refinery, an efficient graph solver for generating well-formed models\",annotation-index.org.opencontainers.image.licenses=EPL-2.0" | ||
] | ||
contexts = { | ||
base = "target:base" | ||
} | ||
} | ||
|
||
target "web" { | ||
dockerfile = "Dockerfile.web" | ||
platforms = ["linux/amd64", "linux/arm64"] | ||
output = [ | ||
"type=image,push=${REFINERY_PUSH},\"name=ghcr.io/graphs4value/refinery:${REFINERY_VERSION},ghcr.io/graphs4value/refinery:latest\",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" | ||
] | ||
contexts = { | ||
base = "target:base" | ||
} | ||
} |
Oops, something went wrong.