Your music, beautifully tracked. All yours. (coming soon) teal.fm
teal-fm atproto

i love ci

Changed files
+161 -8
apps
services
+31 -1
apps/aqua/Dockerfile
··· 1 + # Docker build args for cross-platform builds (must be at the top) 2 + ARG TARGETPLATFORM 3 + ARG BUILDPLATFORM 4 + ARG TARGETARCH 5 + ARG TARGETOS 6 + 1 7 FROM --platform=${BUILDPLATFORM} rust:latest AS buildah 2 8 3 9 # Create appuser ··· 15 21 16 22 WORKDIR /buildah 17 23 24 + # Re-declare ARGs after FROM (Docker requirement) 25 + ARG TARGETPLATFORM 26 + ARG BUILDPLATFORM 27 + ARG TARGETARCH 28 + ARG TARGETOS 29 + 30 + # Debug platform detection before copying files 31 + RUN echo "DEBUG Before copy: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH BUILDPLATFORM=$BUILDPLATFORM" 32 + 18 33 COPY ./ . 19 34 20 - RUN . ./target.sh && touch src/main.rs && echo "Building for $TARGET_ARCH" && cargo build --release --target $RUST_TARGET && cp target/$RUST_TARGET/release/aqua target/aqua 35 + # Install cross-compilation toolchains 36 + RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu 37 + 38 + # Install cross-compilation tools for ARM64 39 + RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu && rm -rf /var/lib/apt/lists/* 40 + 41 + # Set up cross-compilation environment 42 + ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc 43 + 44 + # Debug platform detection and run build 45 + RUN echo "DEBUG Before target.sh: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH" && \ 46 + . ./target.sh && \ 47 + touch src/main.rs && \ 48 + echo "Building for $TARGET_ARCH" && \ 49 + cargo build --release --target $RUST_TARGET && \ 50 + cp target/$RUST_TARGET/release/aqua target/aqua 21 51 22 52 FROM --platform=${TARGETARCH:-$BUILDPLATFORM} gcr.io/distroless/cc 23 53
+55
apps/aqua/target.sh
··· 1 + #!/bin/bash 2 + set -e 3 + 4 + # Debug: Print all available build variables 5 + echo "DEBUG: TARGETPLATFORM=$TARGETPLATFORM" 6 + echo "DEBUG: BUILDPLATFORM=$BUILDPLATFORM" 7 + echo "DEBUG: TARGETARCH=$TARGETARCH" 8 + echo "DEBUG: TARGETOS=$TARGETOS" 9 + 10 + # Use TARGETARCH directly (more reliable than TARGETPLATFORM) 11 + TARGET_ARCH_VAR="${TARGETARCH:-}" 12 + 13 + # If TARGETARCH is not set, try to extract from TARGETPLATFORM 14 + if [ -z "$TARGET_ARCH_VAR" ] && [ -n "$TARGETPLATFORM" ]; then 15 + TARGET_ARCH_VAR=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) 16 + echo "DEBUG: Extracted TARGET_ARCH_VAR=$TARGET_ARCH_VAR from TARGETPLATFORM" 17 + fi 18 + 19 + # Final fallback: detect from uname 20 + if [ -z "$TARGET_ARCH_VAR" ]; then 21 + ARCH=$(uname -m) 22 + case "$ARCH" in 23 + "x86_64") 24 + TARGET_ARCH_VAR="amd64" 25 + ;; 26 + "aarch64") 27 + TARGET_ARCH_VAR="arm64" 28 + ;; 29 + *) 30 + echo "ERROR: Could not detect target architecture. uname -m returned: $ARCH" 31 + echo "Available variables: TARGETARCH=$TARGETARCH, TARGETPLATFORM=$TARGETPLATFORM" 32 + exit 1 33 + ;; 34 + esac 35 + echo "DEBUG: Detected TARGET_ARCH_VAR=$TARGET_ARCH_VAR from uname" 36 + fi 37 + 38 + # Map architecture to Rust target 39 + case "$TARGET_ARCH_VAR" in 40 + "amd64") 41 + export RUST_TARGET="x86_64-unknown-linux-gnu" 42 + export TARGET_ARCH="amd64" 43 + ;; 44 + "arm64") 45 + export RUST_TARGET="aarch64-unknown-linux-gnu" 46 + export TARGET_ARCH="arm64" 47 + ;; 48 + *) 49 + echo "ERROR: Unsupported target architecture: $TARGET_ARCH_VAR" 50 + echo "Supported architectures: amd64, arm64" 51 + exit 1 52 + ;; 53 + esac 54 + 55 + echo "SUCCESS: Using RUST_TARGET=$RUST_TARGET, TARGET_ARCH=$TARGET_ARCH"
+31 -1
services/cadet/Dockerfile
··· 1 + # Docker build args for cross-platform builds (must be at the top) 2 + ARG TARGETPLATFORM 3 + ARG BUILDPLATFORM 4 + ARG TARGETARCH 5 + ARG TARGETOS 6 + 1 7 FROM --platform=${BUILDPLATFORM} rust:latest AS buildah 2 8 3 9 # Create appuser ··· 15 21 16 22 WORKDIR /buildah 17 23 24 + # Re-declare ARGs after FROM (Docker requirement) 25 + ARG TARGETPLATFORM 26 + ARG BUILDPLATFORM 27 + ARG TARGETARCH 28 + ARG TARGETOS 29 + 30 + # Debug platform detection before copying files 31 + RUN echo "DEBUG Before copy: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH BUILDPLATFORM=$BUILDPLATFORM" 32 + 18 33 COPY ./ . 19 34 20 - RUN . ./target.sh && touch src/main.rs && echo "Building for $TARGET_ARCH" && cargo build --release --target $RUST_TARGET && cp target/$RUST_TARGET/release/cadet target/cadet 35 + # Install cross-compilation toolchains 36 + RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu 37 + 38 + # Install cross-compilation tools for ARM64 39 + RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu && rm -rf /var/lib/apt/lists/* 40 + 41 + # Set up cross-compilation environment 42 + ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc 43 + 44 + # Debug platform detection and run build 45 + RUN echo "DEBUG Before target.sh: TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH" && \ 46 + . ./target.sh && \ 47 + touch src/main.rs && \ 48 + echo "Building for $TARGET_ARCH" && \ 49 + cargo build --release --target $RUST_TARGET && \ 50 + cp target/$RUST_TARGET/release/cadet target/cadet 21 51 22 52 FROM --platform=${TARGETARCH:-$BUILDPLATFORM} gcr.io/distroless/cc 23 53
+44 -6
services/cadet/target.sh
··· 1 1 #!/bin/bash 2 - # Taken from https://github.com/DataDog/sdlc-gitops-sample-stack/blob/main/apps/pass-image-api/scripts/target.sh 3 2 set -e 4 3 5 - # Map TARGETPLATFORM to Rust target 6 - case "$TARGETPLATFORM" in 7 - "linux/amd64") 4 + # Debug: Print all available build variables 5 + echo "DEBUG: TARGETPLATFORM=$TARGETPLATFORM" 6 + echo "DEBUG: BUILDPLATFORM=$BUILDPLATFORM" 7 + echo "DEBUG: TARGETARCH=$TARGETARCH" 8 + echo "DEBUG: TARGETOS=$TARGETOS" 9 + 10 + # Use TARGETARCH directly (more reliable than TARGETPLATFORM) 11 + TARGET_ARCH_VAR="${TARGETARCH:-}" 12 + 13 + # If TARGETARCH is not set, try to extract from TARGETPLATFORM 14 + if [ -z "$TARGET_ARCH_VAR" ] && [ -n "$TARGETPLATFORM" ]; then 15 + TARGET_ARCH_VAR=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) 16 + echo "DEBUG: Extracted TARGET_ARCH_VAR=$TARGET_ARCH_VAR from TARGETPLATFORM" 17 + fi 18 + 19 + # Final fallback: detect from uname 20 + if [ -z "$TARGET_ARCH_VAR" ]; then 21 + ARCH=$(uname -m) 22 + case "$ARCH" in 23 + "x86_64") 24 + TARGET_ARCH_VAR="amd64" 25 + ;; 26 + "aarch64") 27 + TARGET_ARCH_VAR="arm64" 28 + ;; 29 + *) 30 + echo "ERROR: Could not detect target architecture. uname -m returned: $ARCH" 31 + echo "Available variables: TARGETARCH=$TARGETARCH, TARGETPLATFORM=$TARGETPLATFORM" 32 + exit 1 33 + ;; 34 + esac 35 + echo "DEBUG: Detected TARGET_ARCH_VAR=$TARGET_ARCH_VAR from uname" 36 + fi 37 + 38 + # Map architecture to Rust target 39 + case "$TARGET_ARCH_VAR" in 40 + "amd64") 8 41 export RUST_TARGET="x86_64-unknown-linux-gnu" 42 + export TARGET_ARCH="amd64" 9 43 ;; 10 - "linux/arm64") 44 + "arm64") 11 45 export RUST_TARGET="aarch64-unknown-linux-gnu" 46 + export TARGET_ARCH="arm64" 12 47 ;; 13 48 *) 14 - echo "Unsupported platform: $TARGETPLATFORM" 49 + echo "ERROR: Unsupported target architecture: $TARGET_ARCH_VAR" 50 + echo "Supported architectures: amd64, arm64" 15 51 exit 1 16 52 ;; 17 53 esac 54 + 55 + echo "SUCCESS: Using RUST_TARGET=$RUST_TARGET, TARGET_ARCH=$TARGET_ARCH"