Coder Social home page Coder Social logo

Comments (4)

thesamet avatar thesamet commented on June 12, 2024

I could make it work with a more recent version of graalvm. From whatever reason gu install native-image failed on the version you have used.

FROM sbtscala/scala-sbt:graalvm-ce-22.3.3-b1-java17_1.9.6_3.3.1 as protoc_gen_scala
RUN mkdir -p /scala-protobuf
ARG PROTOC_GEN_SCALA_VERSION=v0.11.13
RUN curl -sSL https://api.github.com/repos/scalapb/ScalaPB/tarball/${PROTOC_GEN_SCALA_VERSION} | tar xz --strip 1 -C /scala-protobuf
WORKDIR /scala-protobuf
RUN gu install native-image
# Make sbt use the version of native-image installed by gu instead of downloading a separate version
ARG NATIVE_IMAGE_INSTALLED=true
RUN ./make_reflect_config.sh
RUN sbt protocGenScalaNativeImage/nativeImage
RUN install -D /scala-protobuf/target/protoc-gen-scala /out/usr/bin/protoc-gen-scala

When running the Dockerfile you supplied, the reason for the failure (native-image not being found) is hidden. To expose it, you can create a file like this

tmp_reflect_config.sh

#!/usr/bin/env bash
set -e
TMPDIR=$(mktemp -d)
PROTOFILES=$(find e2e/src/main/protobuf -name "*.proto" -print)

sbt "set ThisBuild / version := \"SNAPSHOT\"" protoc-gen-scala-unix/assembly
printf "#!/usr/bin/env bash\nset -e\n" > $TMPDIR/plugin.sh
echo export JAVA_OPTS=-agentlib:native-image-agent=config-output-dir=protoc-gen-scala-native-image/native-image-config >> $TMPDIR/plugin.sh
echo $PWD/.protoc-gen-scala-unix/target/scala-2.12/protoc-gen-scala-unix-assembly-SNAPSHOT.jar >> $TMPDIR/plugin.sh

chmod +x $TMPDIR/plugin.sh

mkdir -p protoc-gen-scala-native-image/native-image-config

$TMPDIR/plugin.sh

And try this Dockerfile

FROM sbtscala/scala-sbt:graalvm-ce-22.3.3-b1-java17_1.9.6_3.3.1 as protoc_gen_scala
RUN mkdir -p /scala-protobuf
ARG PROTOC_GEN_SCALA_VERSION=v0.11.13
RUN curl -sSL https://api.github.com/repos/scalapb/ScalaPB/tarball/${PROTOC_GEN_SCALA_VERSION} | tar xz --strip 1 -C /scala-protobuf
WORKDIR /scala-protobuf
RUN gu install native-image
# Make sbt use the version of native-image installed by gu instead of downloading a separate version
ARG NATIVE_IMAGE_INSTALLED=true
ADD tmp_reflect_config.sh /scala-protobuf/
RUN ./tmp_reflect_config.sh

The script above tries to run `plugin.sh directly, so the error about missing native-image becomes visible.

Hope this helps!

from scalapb.

strophy avatar strophy commented on June 12, 2024

Thanks for the help @thesamet! Before we go with this update, it looks like gu won't exist for much longer though, which might be why that oracle.com URL in my first post stopped working? Also, am I correct in understanding the b1 in the new version indicates it is a beta release?

from scalapb.

thesamet avatar thesamet commented on June 12, 2024

Hi @strophy , my intent was to show that the only thing that was needed to make your Dockerfile work was to update to a more recent version of the docker image you have been using. I am not sure what b1 stands for, but you may be able to find a different stable version that works, though it's beyond the support I can provide as a maintainer of ScalaPB - the answers for this should come from graalvm team or https://github.com/sbt/docker-sbt projects as this is not ScalaPB specific.

from scalapb.

strophy avatar strophy commented on June 12, 2024

I ran into some more problems running the build for ARM64 in QEMU, but updating to the latest tonistiigi/binfmt to update QEMU resolved it. Build is working again, thanks!

from scalapb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.