Playing with static still
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m30s
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 1m30s
This commit is contained in:
parent
1b35f74bfe
commit
8ec4976cc0
@ -1,4 +1,4 @@
|
|||||||
FROM alpine:latest
|
FROM --platform=$BUILDPLATFORM alpine:latest AS builder
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
@ -31,4 +31,6 @@ RUN cmake -G Ninja -B build_static -DCMAKE_BUILD_TYPE=Release \
|
|||||||
|
|
||||||
RUN cmake --build build_static
|
RUN cmake --build build_static
|
||||||
|
|
||||||
# The resulting binary will be in build_static/dropshell
|
# Final stage that only contains the binary
|
||||||
|
FROM scratch AS dropshell
|
||||||
|
COPY --from=builder /build/build_static/dropshell /dropshell
|
@ -1,11 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Build the Docker image
|
# Create output directory
|
||||||
docker build -t dropshell-static-builder .
|
mkdir -p output
|
||||||
|
|
||||||
# Create a container and copy the binary
|
# Create and use a new builder instance
|
||||||
docker create --name temp-container dropshell-static-builder
|
docker buildx create --name multiarch-builder --use || true
|
||||||
docker cp temp-container:/build/build_static/dropshell ./output/dropshell-static
|
|
||||||
docker rm temp-container
|
|
||||||
|
|
||||||
echo "Static binary has been created as 'output/dropshell-static'"
|
# Build for amd64
|
||||||
|
docker buildx build --platform linux/amd64 \
|
||||||
|
--tag dropshell-static-builder \
|
||||||
|
--output type=local,dest=./output/amd64 \
|
||||||
|
--target dropshell \
|
||||||
|
.
|
||||||
|
|
||||||
|
# Build for arm64
|
||||||
|
docker buildx build --platform linux/arm64 \
|
||||||
|
--tag dropshell-static-builder \
|
||||||
|
--output type=local,dest=./output/arm64 \
|
||||||
|
--target dropshell \
|
||||||
|
.
|
||||||
|
|
||||||
|
# Move the binaries to the output directory with architecture-specific names
|
||||||
|
cp output/amd64/dropshell output/dropshell.amd64
|
||||||
|
cp output/arm64/dropshell output/dropshell.arm64
|
||||||
|
|
||||||
|
# Clean up intermediate directories
|
||||||
|
rm -rf output/amd64 output/arm64
|
||||||
|
|
||||||
|
echo "Static binaries have been created:"
|
||||||
|
ls -la output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user