Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dockerfile to xc for raspberry pi #218

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"