Craziness with multiarch
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m18s
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m18s
This commit is contained in:
70
source/Dockerfile.multiarch
Normal file
70
source/Dockerfile.multiarch
Normal file
@ -0,0 +1,70 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
FROM --platform=$BUILDPLATFORM alpine:3.19 AS deps
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
build-base \
|
||||
cmake \
|
||||
git \
|
||||
linux-headers \
|
||||
musl-dev \
|
||||
zlib-dev \
|
||||
bzip2-dev \
|
||||
xz-dev \
|
||||
zstd-dev \
|
||||
curl \
|
||||
bash \
|
||||
gcc \
|
||||
g++ \
|
||||
libstdc++ \
|
||||
libstdc++-dev \
|
||||
ccache \
|
||||
ninja
|
||||
|
||||
FROM deps AS build
|
||||
|
||||
ARG TARGETARCH
|
||||
WORKDIR /source
|
||||
COPY . .
|
||||
|
||||
# Create and run build script
|
||||
RUN printf '#!/bin/bash\n\
|
||||
set -e\n\
|
||||
echo "Setting up build directory..."\n\
|
||||
mkdir -p /build/ccache\n\
|
||||
mkdir -p /build/build_${TARGETARCH}\n\
|
||||
\n\
|
||||
echo "Setting up ccache..."\n\
|
||||
export CCACHE_DIR=/build/ccache\n\
|
||||
export CCACHE_MAXSIZE=2G\n\
|
||||
export PATH="/usr/lib/ccache/bin:$PATH"\n\
|
||||
\n\
|
||||
echo "Running CMake configuration..."\n\
|
||||
cd /build/build_${TARGETARCH}\n\
|
||||
cmake /source -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache 2>&1 | tee cmake.log\n\
|
||||
\n\
|
||||
echo "Starting build..."\n\
|
||||
ninja -v -j$(nproc) 2>&1 | tee build.log\n\
|
||||
\n\
|
||||
echo "Build complete. Checking for binary..."\n\
|
||||
if [ ! -f dropshell ]; then\n\
|
||||
echo "Build failed. Directory contents:"\n\
|
||||
ls -la\n\
|
||||
echo "CMake log:"\n\
|
||||
cat cmake.log\n\
|
||||
echo "Build log:"\n\
|
||||
cat build.log\n\
|
||||
exit 1\n\
|
||||
fi\n\
|
||||
\n\
|
||||
echo "ccache stats:"\n\
|
||||
ccache -s\n' > /source/docker_build.sh && chmod +x /source/docker_build.sh && /source/docker_build.sh
|
||||
|
||||
# Final stage: copy out the binary
|
||||
FROM scratch AS export-stage
|
||||
ARG TARGETARCH
|
||||
COPY --from=build /build/build_${TARGETARCH}/dropshell /dropshell
|
Reference in New Issue
Block a user