diff options
Diffstat (limited to '')
| -rwxr-xr-x | container-run.sh | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/container-run.sh b/container-run.sh index 6865e32..23f1fbf 100755 --- a/container-run.sh +++ b/container-run.sh | |||
| @@ -7,8 +7,13 @@ | |||
| 7 | # ./container-run.sh arm ./build test | 7 | # ./container-run.sh arm ./build test |
| 8 | # | 8 | # |
| 9 | # builds nissy and runs the unit tests in an ARM container. | 9 | # builds nissy and runs the unit tests in an ARM container. |
| 10 | # The container images are based on Debian Linux, see Dockerfile for details. | 10 | # |
| 11 | # The images are built with a tag starting with 'localhost/nissy/'. | 11 | # The containers are based on Alpine Linux and the contain the necessary tools |
| 12 | # to build the main library and the C++ and Python examples. They DO NOT | ||
| 13 | # contain the emscripten compiler, so they cannot be used to build the web | ||
| 14 | # version (e.g. ./build web or ./buidl webtest). | ||
| 15 | # The images are given a tag starting with 'localhost/nissy/'. | ||
| 16 | # | ||
| 12 | # See below for a list of options. | 17 | # See below for a list of options. |
| 13 | 18 | ||
| 14 | usage() { | 19 | usage() { |
| @@ -45,13 +50,27 @@ arm|arm64) | |||
| 45 | ;; | 50 | ;; |
| 46 | esac | 51 | esac |
| 47 | 52 | ||
| 53 | image="localhost/nissy/alpine-$p" | ||
| 48 | platform="--platform=linux/$p" | 54 | platform="--platform=linux/$p" |
| 49 | image="localhost/nissy/debian-$p" | 55 | mount="--mount type=bind,src=./,dst=/nissy-core" |
| 56 | flags="--rm --privileged" | ||
| 57 | |||
| 58 | dockerfile="$(mktemp)" | ||
| 59 | cat > "$dockerfile" << EOF | ||
| 60 | FROM alpine:3.22.1 | ||
| 61 | RUN apk update | ||
| 62 | RUN apk add gcc g++ clang python3 python3-dev | ||
| 63 | #COPY . ./nissy-core | ||
| 64 | RUN mkdir /nissy-core | ||
| 65 | WORKDIR /nissy-core | ||
| 66 | USER 1000:1000 | ||
| 67 | EOF | ||
| 50 | 68 | ||
| 51 | docker build "$platform" -t "$image" . | 69 | docker build "$platform" -f "$dockerfile" -t "$image" . |
| 70 | rm "$dockerfile" | ||
| 52 | 71 | ||
| 53 | if [ -z "$2" ]; then | 72 | if [ -z "$2" ]; then |
| 54 | docker run --rm "$platform" -it "$image" /bin/sh | 73 | docker run $flags $mount "$platform" -it "$image" /bin/sh |
| 55 | else | 74 | else |
| 56 | docker run --rm "$platform" -t "$image" $@ | 75 | docker run $flags $mount "$platform" -t "$image" $@ |
| 57 | fi | 76 | fi |
