mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-01 20:42:11 +00:00
fix for multi platform builds
This commit is contained in:
parent
08779bc0b6
commit
78fe0b32a4
1 changed files with 10 additions and 21 deletions
|
@ -1,37 +1,26 @@
|
||||||
FROM rust:latest AS builder
|
FROM rust:latest AS builder
|
||||||
#
|
#
|
||||||
# Detect architecture and set target accordingly
|
RUN apt update && apt install -y git musl-tools musl-dev libzstd-dev
|
||||||
RUN arch=$(arch) && \
|
|
||||||
if [ "$arch" = "x86_64" ]; then \
|
|
||||||
rustup target add x86_64-unknown-linux-musl; \
|
|
||||||
echo "TARGET_ARCH=x86_64-unknown-linux-musl" > /target_arch.env; \
|
|
||||||
elif [ "$arch" = "aarch64" ]; then \
|
|
||||||
rustup target add aarch64-unknown-linux-musl; \
|
|
||||||
echo "TARGET_ARCH=aarch64-unknown-linux-musl" > /target_arch.env; \
|
|
||||||
else \
|
|
||||||
echo "Unsupported architecture: $arch"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
RUN apt update && apt install -y git musl-tools musl-dev
|
|
||||||
RUN update-ca-certificates
|
RUN update-ca-certificates
|
||||||
RUN git clone https://github.com/t3chn0m4g3/honeyaml /opt/honeyaml
|
RUN git clone https://github.com/t3chn0m4g3/honeyaml /opt/honeyaml
|
||||||
#
|
#
|
||||||
WORKDIR /opt/honeyaml
|
WORKDIR /opt/honeyaml
|
||||||
# Load target architecture from file and build
|
# Need to dynamically link, otherwise multi platform builds are breaking with zstd-sys
|
||||||
RUN . /target_arch.env && \
|
RUN cargo build --release && \
|
||||||
cargo build --target "$TARGET_ARCH" --release && \
|
cp target/release/honeyaml /opt/honeyaml/
|
||||||
cp target/"$TARGET_ARCH"/release/honeyaml /opt/honeyaml/
|
|
||||||
#
|
#
|
||||||
FROM alpine:3.20
|
# Using wolfi instead of ubuntu because of smaller footprint (and required full glibc support)
|
||||||
|
FROM chainguard/wolfi-base:latest
|
||||||
#
|
#
|
||||||
COPY --from=builder /opt/honeyaml/honeyaml /opt/honeyaml/
|
COPY --from=builder /opt/honeyaml/honeyaml /opt/honeyaml/
|
||||||
COPY --from=builder /opt/honeyaml/api.yml /opt/honeyaml/
|
COPY --from=builder /opt/honeyaml/api.yml /opt/honeyaml/
|
||||||
#
|
#
|
||||||
# Setup user, groups and configs
|
# Setup user, groups and configs
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
addgroup -g 2000 honeyaml
|
apk update
|
||||||
adduser -S -s /bin/ash -u 2000 -D -g 2000 honeyaml
|
apk add libstdc++
|
||||||
|
addgroup --gid 2000 honeyaml
|
||||||
|
adduser -S -H -s /bin/sh -u 2000 -D honeyaml -G honeyaml
|
||||||
EOF
|
EOF
|
||||||
#
|
#
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
|
|
Loading…
Reference in a new issue