-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2086 | ||
|
||
set -x | ||
set -eo pipefail | ||
|
||
if [[ -z "${TARGET}" ]]; then | ||
export TARGET="aarch64-unknown-linux-gnu" | ||
fi | ||
if [[ -z "${CROSS_TARGET_CROSS_IMAGE}" ]]; then | ||
CROSS_TARGET_CROSS_IMAGE="ghcr.io/cross-rs/cross:main" | ||
fi | ||
|
||
main() { | ||
docker run --rm -e TARGET \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
"${CROSS_TARGET_CROSS_IMAGE}" sh -c ' | ||
#!/usr/bin/env sh | ||
td="$(mktemp -d)" | ||
git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}" | ||
cd "${td}" | ||
cross run --target "${TARGET}" | ||
' | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ubuntu:20.04 as rust | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
COPY docker/lib.sh docker/cross.sh / | ||
COPY ./ /project | ||
RUN /cross.sh /project | ||
|
||
# we build our images in 2 steps, to ensure we have a compact | ||
# image, since we want to add our current subdirectory | ||
FROM ubuntu:20.04 | ||
COPY --from=rust /root/.cargo /root/.cargo | ||
COPY --from=rust /root/.rustup /root/.rustup | ||
|
||
# need some basic devtools, and requirements for docker | ||
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
git | ||
|
||
RUN curl -fsSL https://get.docker.com | sh | ||
|
||
ENV CROSS_CONTAINER_IN_CONTAINER=1 \ | ||
PATH=/root/.cargo/bin:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC1090,SC1091 | ||
|
||
set -x | ||
set -euo pipefail | ||
|
||
. lib.sh | ||
|
||
main() { | ||
local project_dir="${1}" | ||
|
||
install_packages ca-certificates curl gcc libc6-dev | ||
|
||
cd "${project_dir}" | ||
curl --proto "=https" --tlsv1.2 --retry 3 -sSfL https://sh.rustup.rs | sh -s -- -y | ||
source "${HOME}"/.cargo/env | ||
cargo install --path . --locked | ||
|
||
purge_packages | ||
|
||
rm -rf "${0}" | ||
} | ||
|
||
main "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters