fix: update alpine image

This commit is contained in:
Samuel Fernandes 2025-01-17 17:10:23 +00:00
parent fab9375a35
commit 70e710c9b8
No known key found for this signature in database
GPG Key ID: C74A5164FE13D9B6

View File

@ -2,7 +2,6 @@ FROM alpine:3.18
# Install build dependencies
RUN apk add --no-cache \
openjdk11 \
cmake \
make \
gcc \
@ -11,38 +10,7 @@ RUN apk add --no-cache \
linux-headers
# Set workspace directory
WORKDIR /workspace
# Copy the source code
COPY . .
WORKDIR /work
# Build the project
ENV CC=gcc CXX=g++ TARGET_OS=Linux-musl
# Install Maven
RUN apk add --no-cache maven
# Build with Maven
RUN mvn package -Dlibrary.name=libsnappyjava.so -DskipTests -DskipJavadoc=true
# Install snappy dependencies
RUN apk add --no-cache snappy-dev
# Compile and link statically
RUN cd target/native/Linux-musl/x86_64 && \
${CXX} -std=c++11 -O2 -fPIC -DPIC -D_GNU_SOURCE \
-I../../../../src/main/java/org/xerial/snappy/ \
-I/usr/include \
-shared -static-libstdc++ -static-libgcc \
../../../../src/main/java/org/xerial/snappy/SnappyNative.cpp \
-L/usr/lib -lsnappy \
-o libsnappyjava.so
# Create necessary directories
RUN mkdir -p src/main/resources/org/xerial/snappy/native/Linux-musl/x86_64/
# Copy the built library
RUN cp target/native/Linux-musl/x86_64/libsnappyjava.so src/main/resources/org/xerial/snappy/native/Linux-musl/x86_64/
# Set the entry point
ENTRYPOINT ["java"]