diff --git a/build/Dockerfile b/build/Dockerfile index aa3166a..460f7ed 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -8,14 +8,21 @@ COPY src ./src # Installiere notwendige Tools RUN apt-get update && apt-get install -y musl-tools -# Erstelle den Build für beide Architekturen (amd64 und aarch64) +# Setze das Target Triple basierend auf der Architektur ARG TARGETARCH +ENV RUST_TARGET_TRIPLE=${TARGETARCH} -RUN rustup target add ${TARGETARCH}-unknown-linux-musl && \ - cargo build --release --target ${TARGETARCH}-unknown-linux-musl +# Mapping der Architektur zu den korrekten Rust Triple +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + export RUST_TARGET_TRIPLE=x86_64-unknown-linux-musl; \ + elif [ "$TARGETARCH" = "arm64" ]; then \ + export RUST_TARGET_TRIPLE=aarch64-unknown-linux-musl; \ + fi && \ + rustup target add ${RUST_TARGET_TRIPLE} && \ + cargo build --release --target ${RUST_TARGET_TRIPLE} # Der finale Stage, der das Ergebnis des Builds verwendet FROM scratch -COPY --from=builder /app/target/${TARGETARCH}-unknown-linux-musl/release/cronjoblistener /app/cronjoblistener +COPY --from=builder /app/target/${RUST_TARGET_TRIPLE}/release/cronjoblistener /app/cronjoblistener ENTRYPOINT ["/app/cronjoblistener"] \ No newline at end of file