This commit is contained in:
44
Dockerfile.dropshell-build
Normal file
44
Dockerfile.dropshell-build
Normal file
@ -0,0 +1,44 @@
|
||||
FROM --platform=$BUILDPLATFORM alpine:latest AS builder
|
||||
|
||||
ARG PROJECT
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
build-base \
|
||||
cmake \
|
||||
git \
|
||||
musl-dev \
|
||||
curl \
|
||||
bash \
|
||||
musl \
|
||||
g++ \
|
||||
ninja \
|
||||
linux-headers \
|
||||
mold \
|
||||
zlib-static
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /build
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
|
||||
# Configure and build
|
||||
RUN mkdir -p build_static && \
|
||||
cmake -G Ninja -B build_static -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-static" \
|
||||
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
|
||||
-DZLIB_BUILD_SHARED=OFF \
|
||||
-DZLIB_BUILD_STATIC=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DPROJECT_NAME="${PROJECT}" \
|
||||
${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE}
|
||||
|
||||
RUN cmake --build build_static
|
||||
|
||||
# Final stage that only contains the binary
|
||||
FROM scratch AS project
|
||||
|
||||
ARG PROJECT
|
||||
|
||||
COPY --from=builder /build/build_static/${PROJECT} /${PROJECT}
|
Reference in New Issue
Block a user