Skip to content

Commit

Permalink
Add dockerfile to xc for raspberry pi
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanDebrunner committed Nov 30, 2023
1 parent a989e8f commit 129a531
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xc/raspberry-pi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM debian:bullseye

RUN apt update && apt install --no-install-recommends -y libssl-dev pkg-config libasound2-dev gcc-aarch64-linux-gnu curl ca-certificates libc6-dev-arm64-cross

WORKDIR /workdir

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -t 'aarch64-unknown-linux-gnu'
1 change: 1 addition & 0 deletions xc/raspberry-pi/build_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build -t "rpi-xc-bullseye-aarch64" .
22 changes: 22 additions & 0 deletions xc/raspberry-pi/do_xc_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set -x

TARGET_TRIPLE="aarch64-unknown-linux-gnu"
IMAGE_NAME="rpi-xc-bullseye-aarch64"

CARGO_ARGS="build --bin refbox --target $TARGET_TRIPLE --release"
CONTAINER_WORKDIR="/workdir/uwh-refbox-rs"

CONTAINER_NAME="$(docker create -t -w "$CONTAINER_WORKDIR/" $IMAGE_NAME /root/.cargo/bin/cargo $CARGO_ARGS)"

BASE_DIR="$(dirname "$0")/../.."

for file in $(ls "$BASE_DIR" | grep -v target | grep -v xc); do
docker cp "$BASE_DIR/$file" "$CONTAINER_NAME:$CONTAINER_WORKDIR/"
done

docker start -a "$CONTAINER_NAME"

docker cp "$CONTAINER_NAME:$CONTAINER_WORKDIR/target/release/refbox" "$(dirname "$0")/output/$TARGET_TRIPLE/"
docker cp "$CONTAINER_NAME:$CONTAINER_WORKDIR/target/$TARGET_TRIPLE/release/refbox" "$(dirname "$0")/output/"

docker rm "$CONTAINER_NAME"

0 comments on commit 129a531

Please sign in to comment.