diff --git a/tool/Dockerfile.build b/tool/Dockerfile.build new file mode 100644 index 00000000..7996b406 --- /dev/null +++ b/tool/Dockerfile.build @@ -0,0 +1,19 @@ +FROM debian:stable-slim + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + # dependencies to install flutter + git curl unzip ca-certificates \ + # dependencies to build for linux + clang cmake ninja-build pkg-config libgtk-3-dev \ + # dependencies for the app + libayatana-appindicator3-dev + +ARG FLUTTER_VERSION +RUN git clone -b $FLUTTER_VERSION https://github.com/flutter/flutter /flutter +ENV PATH=$PATH:/flutter/bin +RUN flutter doctor -v +RUN flutter precache --linux + +ADD docker/build.sh /build.sh +CMD /build.sh diff --git a/tool/build-neon.sh b/tool/build-neon.sh new file mode 100755 index 00000000..f9b6339f --- /dev/null +++ b/tool/build-neon.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -euxo pipefail +cd "$(dirname "$0")/.." + +arches=("amd64" "arm64") +flutter_version="$(jq ".flutterSdkVersion" -r < .fvm/fvm_config.json | cut -d "@" -f 1)" + +function cleanup() { + cd packages/neon + rm -rf .packages .dart_tool + fvm flutter pub get +} +trap cleanup EXIT + +for arch in "${arches[@]}"; do + docker buildx build \ + --platform "linux/$arch" \ + --progress plain \ + -t "nextcloud-neon-build:$arch" \ + --build-arg="FLUTTER_VERSION=$flutter_version" \ + -f tool/Dockerfile.build \ + ./tool + + docker run \ + --platform "linux/$arch" \ + --rm -it \ + -e "ORIGINAL_USER=$(id -u)" \ + -e "ORIGINAL_GROUP=$(id -g)" \ + -v "$(pwd):/src" \ + "nextcloud-neon-build:$arch" +done diff --git a/tool/docker/build.sh b/tool/docker/build.sh new file mode 100755 index 00000000..05e93cb2 --- /dev/null +++ b/tool/docker/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -euxo pipefail + +function cleanup() { + chown -R "$ORIGINAL_USER:$ORIGINAL_GROUP" . +} +trap cleanup EXIT + +cd /src/packages/neon + +rm -rf .packages .dart_tool +flutter build linux