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

cwebp binary does not install when running in docker image #296

Open
lee-queueone opened this issue Sep 10, 2024 · 1 comment
Open

cwebp binary does not install when running in docker image #296

lee-queueone opened this issue Sep 10, 2024 · 1 comment

Comments

@lee-queueone
Copy link

//build.gradle.kts
implementation("com.sksamuel.scrimage:scrimage-core:4.2.0")
implementation("com.sksamuel.scrimage:scrimage-webp:4.2.0")

I invoke my method convertToWebP

class Image {
companion object {
fun convertToWebP(fileStream: InputStream): ByteArray {
val image = ImmutableImage.loader().fromStream(fileStream)
val writer: WebpWriter
try {
writer = WebpWriter().withM(6).withQ(75)
} catch (e: Exception) {
e.printStackTrace()
throw e
}

        return image.bytes(writer)
    }
}

}

Running locally from intelliJ with amazoncorretto:21, when I invoke the WebpWriter() for the first time, it installs the binaries as expected:
c.sksamuel.scrimage.webp.WebpHandler - Installing binary at /var/folders/fr/t2msts2x4psf58xxklmsxgb00000gn/T/cwebp16223531167641905488binary
c.sksamuel.scrimage.webp.WebpHandler - Setting executable /var/folders/fr/t2msts2x4psf58xxklmsxgb00000gn/T/cwebp16223531167641905488binary
c.sksamuel.scrimage.webp.WebpHandler - Installing binary at /var/folders/fr/t2msts2x4psf58xxklmsxgb00000gn/T/dwebp7146283123708512948binary
c.sksamuel.scrimage.webp.WebpHandler - Setting executable /var/folders/fr/t2msts2x4psf58xxklmsxgb00000gn/T/dwebp7146283123708512948binary

I build a docker image with the same runtime. When I make the initial request to the service, it only installs the dwebp binary and then fails.

I tried to follow the instructions at https://sksamuel.github.io/scrimage/webp/ to override some of the behaviour, but it doesn't seem to work.
I've tried things like invoking the installer method at app startup - this actually shows that the cwebp binary installed at some directory, but the same error happens.
I've also tried to install the webp tools during the build process and copy them into a directory, and override the system property with that directory in hopes it would find the binary files.

Any help is appreciated.

@sksamuel
Copy link
Owner

sksamuel commented Dec 1, 2024

I use webp inside docker, so I know it works in general.
What error message are you seeing ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants