Skip to content

Commit

Permalink
Python -> Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
thueske committed Oct 16, 2024
1 parent bded2ce commit e8d16f0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit e8d16f0

Please sign in to comment.