feat: create an alpine compatible image #632
Open
+61
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When importing a data source of a file that was previously compressed using the snappy compression algorithm, the compression fails with the following exception:
This problem occurs since the dockerimage does not containg the
ld-linux-x86-64.so.2
lib, which is from glibc. Alpine images use musl making this incompatible.Having this dependency being linked dynamically can mess things up. Ideally, we would like to have snappy being compiled against a MUSL image.
Snappy removed pure-java mode 1.1.9.0 (https://github.com/xerial/snappy-java/pull/381/files), which could be used to run snappy in non-supported systems with the use of one flag. We could force an older version but it was removed due to some problems (such as data corruption) and older versions than 1.1.9.0 contain critical CVEs (https://mvnrepository.com/artifact/org.xerial.snappy/snappy-java).
Workaround
Alpine images also have some packages that allow us to run binaries precompiled against glibc libraries (they don't allow us to compile against it), such as gcompat. In our case,
libc6-compat
provides/lib64/ld-linux-x86-64.so.2
compatible lib. Turns out that/lib64/ld-linux-x86-64.so.2
is a symlink to/lib/libc.musl-x86_64.so.1
. Adding a/lib/ld-linux-x86-64.so.2
linked to/lib/ld-musl-x86_64.so.1
solves the issue since that is the place snappy is searching for the dependency.This is the same solution employed by https://stackoverflow.com/a/55568352.
Fix
The library now includes native binaries compiled specifically for musl environments, eliminating the need for workarounds like installing
gcompat
orlibc6-compat
packages in Alpine containers.This improvement means:
Closes #616
Closes #239