Skip to content
Open
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 Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ARG TARGET
ENV TARGET=${TARGET}

WORKDIR /work
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ you will help support:
- Unpack and put the binary somewhere in your PATH (i.e. `/usr/local/bin` on linux and macos)
- Note that the binary is not code signed and will cause a warning on windows and macos when running. This will be fixed later, but for now you can find a workaround via your favorite search engine.

### Build static ARM binaries (Docker)

This repository includes Docker scripts for building static ARM binaries with musl.

- ARM64 (aarch64):
- `./dockerbuild.sh aarch64-unknown-linux-musl`
- `./indockerbuild.sh aarch64-unknown-linux-musl`
- Output: `dist/aarch64-unknown-linux-musl/gdrive`
- ARM32 (armv7):
- `./dockerbuild.sh armv7-unknown-linux-musleabihf`
- `./indockerbuild.sh armv7-unknown-linux-musleabihf`
- Output: `dist/armv7-unknown-linux-musleabihf/gdrive`

### Add google account to gdrive

- Run `gdrive account add`
Expand Down
25 changes: 25 additions & 0 deletions dockerbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

TARGET="${1:-aarch64-unknown-linux-musl}"
case "${TARGET}" in
aarch64-unknown-linux-musl)
BASE_IMAGE="messense/rust-musl-cross:aarch64-musl"
;;
armv7-unknown-linux-musleabihf)
BASE_IMAGE="messense/rust-musl-cross:armv7-musleabihf"
;;
*)
echo "Unsupported target: ${TARGET}"
exit 1
;;
esac

IMAGE="gdrive-build:${TARGET}"

docker build \
--build-arg TARGET="${TARGET}" \
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
-t "${IMAGE}" \
-f Dockerfile \
.
15 changes: 15 additions & 0 deletions indockerbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail

TARGET="${1:-aarch64-unknown-linux-musl}"
OUT_DIR="${2:-$(pwd)/dist/${TARGET}}"
IMAGE="gdrive-build:${TARGET}"

mkdir -p "${OUT_DIR}"

docker run --rm \
-v "$(pwd)":/work \
-v "${OUT_DIR}":/out \
-w /work \
"${IMAGE}" \
/bin/sh -c "cargo build --release --target ${TARGET} && cp target/${TARGET}/release/gdrive /out/gdrive"