Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert docker image, implement workarounds for arm64 machines and java #4377

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,43 @@ if [[ "$OS" == "OSX" ]]; then
xattr -d com.apple.quarantine jre/bin/java
fi

chmod +x jre/bin/java #make sure java is executable
chmod +x jre/bin/java #make sure java is executable


if [[ "$OS" == "OSX" ]]; then
#mac doesn't allow random binaries to be executable
#remove the quarantine attribute so java is executable on mac
xattr -d com.apple.quarantine jre/bin/java
fi
chmod +x jre/bin/java #make sure java is executable

chip=$(uname -m)

if [[ $chip == "arm64" || $chip == "aarch64" ]]; then
# This is needed as a hack for now
# This replaces overrides how sbt native packager finds java
# on users machines when the user is running arm64.
# This is needed because we don't have access to a CI environment with arm64
# and the jlink jre we ship is broken because its built against x86
# this simply copies the 'get_java` bash function and removes the first
# check to see if there is a bundled_jvm built by jlink if the detected
# computer arch is arm64 or aarch64. This means a user if they are running
# arm64 / aarch64 will need to provide their own jre
# see https://github.com/bitcoin-s/bitcoin-s/issues/4369!
echo "Removing ARM jre as its not linked correctly, see https://github.com/bitcoin-s/bitcoin-s/issues/4369!"
get_java_no_jlink() {
if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo "$JAVA_HOME/bin/java"
else
echo "java"
fi
}

# java_cmd is overrode in process_args when -java-home is used
declare java_cmd=$(get_java_no_jlink)

# if configuration files exist, prepend their contents to $@ so it can be processed by this runner
[[ -f "$script_conf_file" ]] && set -- $(loadConfigFile "$script_conf_file") "$@"

run "$@"
fi
31 changes: 30 additions & 1 deletion app/server/src/universal/wallet-server-extra-startup-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,34 @@ if [[ "$OS" == "OSX" ]]; then
#remove the quarantine attribute so java is executable on mac
xattr -d com.apple.quarantine jre/bin/java
fi
chmod +x jre/bin/java #make sure java is executable

chmod +x jre/bin/java #make sure java is executable
chip=$(uname -m)

if [[ $chip == "arm64" || $chip == "aarch64" ]]; then
# This is needed as a hack for now
# This replaces overrides how sbt native packager finds java
# on users machines when the user is running arm64.
# This is needed because we don't have access to a CI environment with arm64
# and the jlink jre we ship is broken because its built against x86
# this simply copies the 'get_java` bash function and removes the first
# check to see if there is a bundled_jvm built by jlink if the detected
# computer arch is arm64 or aarch64. This means a user if they are running
# arm64 / aarch64 will need to provide their own jre
echo "Removing ARM jre as its not linked correctly, see https://github.com/bitcoin-s/bitcoin-s/issues/4369!"
get_java_no_jlink() {
if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo "$JAVA_HOME/bin/java"
else
echo "java"
fi
}

# java_cmd is overrode in process_args when -java-home is used
declare java_cmd=$(get_java_no_jlink)

# if configuration files exist, prepend their contents to $@ so it can be processed by this runner
[[ -f "$script_conf_file" ]] && set -- $(loadConfigFile "$script_conf_file") "$@"

run "$@"
fi
2 changes: 1 addition & 1 deletion project/CommonSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ object CommonSettings {
lazy val dockerSettings: Seq[Setting[_]] = {
Vector(
//https://sbt-native-packager.readthedocs.io/en/latest/formats/docker.html
dockerBaseImage := "ubuntu",
dockerBaseImage := "openjdk:17-slim",
dockerRepository := Some("bitcoinscala"),
//set the user to be 'bitcoin-s' rather than
//the default provided by sbt native packager
Expand Down