Skip to content

Commit

Permalink
Add support for building AppImage via docker
Browse files Browse the repository at this point in the history
  • Loading branch information
bsilvereagle committed May 5, 2023
1 parent 97bf27e commit 0e0a993
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
.git/
6 changes: 6 additions & 0 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ cp -v install/bin/* AppDir/usr/bin
--plugin qt --output appimage
```

## Deploy as an AppImage via Docker

```shell
docker buildx build -o . .
```

# Compile in Mac

On Mac, the dependencies can be installed using [brew](https://brew.sh/) with the following command:
Expand Down
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#Download base image ubuntu 18.04
FROM ubuntu:18.04
FROM ubuntu:22.04 as builder

RUN apt update
RUN apt-get update && \
apt-get -y install cmake build-essential wget file qtbase5-dev libqt5svg5-dev libqt5websockets5-dev libqt5opengl5-dev libqt5x11extras5-dev libprotoc-dev libzmq3-dev liblz4-dev libzstd-dev libmosquittopp-dev

RUN apt install cmake git build-essential qtbase5-dev libqt5svg5-dev libqt5websockets5-dev libqt5opengl5-dev libqt5x11extras5-dev nano qt5-default -y && \
rm -rf /var/lib/apt/lists/* && \
apt clean
RUN mkdir -p /opt/plotjuggler
COPY . /opt/plotjuggler
RUN mkdir /opt/plotjuggler/build
WORKDIR /opt/plotjuggler/build
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/usr
RUN make -j `nproc`
RUN make install DESTDIR=AppDir
RUN /opt/plotjuggler/appimage/AppImage.sh

FROM scratch as exporter
COPY --from=builder /opt/plotjuggler/build/PlotJuggler-x86_64.AppImage /

33 changes: 33 additions & 0 deletions appimage/AppImage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

APPDIRPATH=../build/AppDir

# Uses linuxdeploy with linuxdeploy-plugin-qt to generate an AppImage
LINUXDEPLOY_URL="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
LINUXDEPLOY_QT_URL="https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"

LINUXDEPLOY_APPIMAGE="linuxdeploy-x86_64.AppImage"
LINUXDEPLOY_QT_APPIMAGE="linuxdeploy-plugin-qt-x86_64.AppImage"

# Get and extract linuxdeploy AppImage. Extraction is necessary since we are in a container without FUSE support
wget ${LINUXDEPLOY_URL}
chmod +x ${LINUXDEPLOY_APPIMAGE}
mkdir linuxdeploy/
mv ${LINUXDEPLOY_APPIMAGE} linuxdeploy/
cd linuxdeploy
./${LINUXDEPLOY_APPIMAGE} --appimage-extract
cd -

# Same for the plugin
wget ${LINUXDEPLOY_QT_URL}
chmod +x ${LINUXDEPLOY_QT_APPIMAGE}
mkdir linuxdeploy-plugin-qt/
mv ${LINUXDEPLOY_QT_APPIMAGE} linuxdeploy-plugin-qt/
cd linuxdeploy-plugin-qt
./${LINUXDEPLOY_QT_APPIMAGE} --appimage-extract
# Rename the plugin to match linuxdeploy's expected format
mv squashfs-root/AppRun squashfs-root/linuxdeploy-plugin-qt
cd -

PATH=$PATH:linuxdeploy-plugin-qt/squashfs-root ./linuxdeploy/squashfs-root/AppRun --appdir $APPDIRPATH -d ../PlotJuggler.desktop -i ../plotjuggler.png --plugin qt --output appimage

0 comments on commit 0e0a993

Please sign in to comment.