build: Simplify appimage build (#356)

* Simplify creating an AppImage

- package.sh packages the build result into an AppImage. It requires
squashfs-tools to work
- runtime-x86_64 is a binary distributed by the AppImage project that takes
care of extracting and running the image

* use AppRun from AppImage project

* clean up no longer needed bits

* Keep docker way of working around

- Docker now also uses `package.sh`, so no more need for FUSE.
- Fetch binaries instead of storing in git.

* Fix details

* wait a little longer for the container to start
This commit is contained in:
wardwouts
2021-12-03 09:53:15 +01:00
committed by GitHub
parent 21cc8555b5
commit 451c550b19
6 changed files with 100 additions and 56 deletions

View File

@@ -2,6 +2,7 @@ FROM debian:bullseye-slim
LABEL maintainer Example <example@example.com>
ARG TAG=master
ARG REPO=https://github.com/WerWolv/ImHex.git
USER root
@@ -13,13 +14,12 @@ RUN apt-get update \
git \
cmake \
curl \
libfuse2 \
file
squashfs-tools
# Fetch source and dependencies
RUN mkdir -p /source \
&& cd /source \
&& git clone https://github.com/WerWolv/ImHex.git \
&& git clone $REPO \
&& cd ImHex \
&& git checkout $TAG \
&& git submodule update --init --recursive \
@@ -35,27 +35,6 @@ RUN mkdir -p /source/ImHex/build \
&& make -j
# Prepare for AppImage
RUN mkdir -p /source/ImHex.AppDir/usr/bin \
&& mkdir -p /source/ImHex.AppDir/usr/lib \
&& mkdir -p /source/ImHex.AppDir/usr/share/imhex/plugins \
&& cp /source/ImHex/build/imhex /source/ImHex.AppDir/usr/bin/imhex \
&& cp /source/ImHex/build/plugins/builtin/builtin.hexplug /source/ImHex.AppDir/usr/share/imhex/plugins
COPY AppRun ImHex.desktop imhex.png /source/ImHex.AppDir/
#RUN inkscape -z -o /source/ImHex.AppDir/imhex.png -w 128 -h 128 /source/ImHex/res/icon.svg
# Gather the needed libraries
RUN chmod a+x /source/ImHex.AppDir/AppRun \
&& ldd /source/ImHex/build/imhex | awk '/ => /{print $3}' | xargs -I '{}' cp '{}' /source/ImHex.AppDir/usr/lib
# Package the prepared AppDir
RUN cd /source \
&& curl -L https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage -o appimagetool-x86_64.AppImage \
&& chmod a+x appimagetool-x86_64.AppImage
# All that remains is the following. However, due to docker limitations with fuse
# this cannot be done in a build container.
#
# /source/appimagetool-x86_64.AppImage ImHex.AppDir
ENTRYPOINT sh -c '/source/appimagetool-x86_64.AppImage /source/ImHex.AppDir; sleep 60'
RUN cd /source/ImHex/dist/AppImage \
&& ./package.sh /source/ImHex/build \
&& mv /source/ImHex/build/ImHex-x86_64.AppImage /