From 2cc10ab7f3988ad49c88951e4d8f03090ce2a069 Mon Sep 17 00:00:00 2001 From: Alya Sirko Date: Fri, 9 Sep 2022 05:03:56 +0300 Subject: [PATCH] new containerization --- Dockerfile | 48 +++++++++++++++++++++++++++++++++++++++++++++++ appimage.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flatpak.yml | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 Dockerfile create mode 100644 appimage.yml create mode 100644 flatpak.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7efdf1ed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM ubuntu:22.04 + +ENV PACKAGES "build-essential openjdk-11-jdk-headless clang cmake curl git jq libblkid1 libblkid-dev libc6 libc6-dev libc-bin libcrypt1 libdbus-1-3 libexpat1 libffi7 libgcc-s1 libgcrypt20 libgcrypt20-dev libglib2.0-0 libglib2.0-dev libglu1-mesa libgpg-error0 libgtk-3-0 libgtk-3-dev liblz4-1 liblz4-dev liblzma5 liblzma-dev libmount1 libpcre3 libselinux1 libsepol2 libstdc++-10-dev libstdc++6 libuuid1 ninja-build pkg-config rsync unzip xz-utils zlib1g unzip libsecret-1-dev libsecret-tools libsecret-1-0 libjsoncpp-dev fuse flatpak-builder binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync" +ENV ANDROID_SDK_TOOLS_VERSION "commandlinetools-linux-8512546_latest" +ENV ANDROID_SDK_TOOLS_URL "https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip" +ENV FLUTTER_VERSION "flutter_linux_3.3.1-stable" +ENV FLUTTER_URL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.3.1-stable.tar.xz" +ENV FREEDESKTOP_SDK_VERSION "22.08" + +# Update packages +RUN apt-get update && apt-get upgrade -y && apt-get install -y $PACKAGES + +# Add a non-privileged user +RUN useradd -d /var/lib/builder -m -r -s /bin/bash builder +USER builder +WORKDIR /var/lib/builder + +# Install Android SDK +ADD --chown=builder $ANDROID_SDK_TOOLS_URL . +RUN mkdir -p android-sdk/cmdline-tools && unzip $ANDROID_SDK_TOOLS_VERSION.zip \ + && rm $ANDROID_SDK_TOOLS_VERSION.zip && mv cmdline-tools android-sdk/cmdline-tools/latest + +# Install Flutter +ADD --chown=builder $FLUTTER_URL . +RUN tar -vxf $FLUTTER_VERSION.tar.xz && rm $FLUTTER_VERSION.tar.xz + +ENV ANDROID_HOME "/var/lib/builder/android-sdk" +ENV ANDROID_SDK_ROOT "/var/lib/builder/android-sdk" +ENV PATH "$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:/var/lib/builder/flutter/bin:/var/lib/builder/.local/bin" + +# Install needed Android SDK packages +RUN yes | sdkmanager 'build-tools;30.0.3' 'platforms;android-29' 'platforms;android-30' 'platforms;android-31' + +# Prepare dependencies for offline build +RUN git clone --depth=1 --single-branch https://git.selfprivacy.org/kherel/selfprivacy.org.app.git deps +WORKDIR /var/lib/builder/deps +RUN flutter build linux +RUN flutter build apk +WORKDIR /var/lib/builder +RUN rm -rf deps + +# Install AppImage Builder +RUN pip3 install --user appimage-builder + +# Install Flatpak dependencies +RUN flatpak --user remote-add flathub https://flathub.org/repo/flathub.flatpakrepo \ + && flatpak --user install -y org.freedesktop.Sdk/x86_64/$FREEDESKTOP_SDK_VERSION \ + org.freedesktop.Platform/x86_64/$FREEDESKTOP_SDK_VERSION diff --git a/appimage.yml b/appimage.yml new file mode 100644 index 00000000..fe74809d --- /dev/null +++ b/appimage.yml @@ -0,0 +1,53 @@ +# appimage-builder recipe see https://appimage-builder.readthedocs.io for details +version: 1 +script: + - rm -rf AppDir || true + - cp -r build/linux/x64/release/bundle AppDir + - mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps/ + - cp assets/icons/64.png AppDir/usr/share/icons/hicolor/64x64/apps/selfprivacy.png +AppDir: + path: AppDir + app_info: + id: pro.kherel.selfprivacy + name: SelfPrivacy + icon: selfprivacy.png + version: 0.6.0 + exec: selfprivacy + exec_args: $@ + apt: + arch: + - amd64 + allow_unauthenticated: true + sources: + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy universe + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy multiverse + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse + - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse + - sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted + - sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security universe + - sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse + include: + - libjsoncpp-dev + - libsecret-1-0 + test: + fedora-30: + image: appimagecrafters/tests-env:fedora-30 + command: ./AppRun + debian-stable: + image: appimagecrafters/tests-env:debian-stable + command: ./AppRun + archlinux-latest: + image: appimagecrafters/tests-env:archlinux-latest + command: ./AppRun + centos-7: + image: appimagecrafters/tests-env:centos-7 + command: ./AppRun + ubuntu-xenial: + image: appimagecrafters/tests-env:ubuntu-xenial + command: ./AppRun +AppImage: + arch: x86_64 + update-information: guess diff --git a/flatpak.yml b/flatpak.yml new file mode 100644 index 00000000..23a84f73 --- /dev/null +++ b/flatpak.yml @@ -0,0 +1,40 @@ +app-id: pro.kherel.selfprivacy +runtime: org.freedesktop.Platform +runtime-version: '22.08' +sdk: org.freedesktop.Sdk +command: selfprivacy +finish-args: + - "--share=ipc" + - "--socket=x11" + - "--socket=fallback-x11" + - "--socket=wayland" + - "--share=network" + - "--own-name=pro.kherel.selfprivacy" +modules: + - name: selfprivacy + buildsystem: simple + build-commands: + - cp -r * /app + - mkdir /app/bin + - ln -s /app/selfprivacy /app/bin/selfprivacy + sources: + - type: dir + path: build/linux/x64/release/bundle + - name: libsecret + buildsystem: meson + config-opts: + - "-Dvapi=false" + - "-Dgtk_doc=false" + sources: + - type: git + url: https://gitlab.gnome.org/GNOME/libsecret.git + tag: 0.20.5 + - name: libjsoncpp + buildsystem: meson + config-opts: + - "--buildtype=release" + - "--default-library=shared" + sources: + - type: git + url: https://github.com/open-source-parsers/jsoncpp.git + tag: 1.9.5