summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <markwkm@gmail.com>2021-06-11 13:11:28 -0700
committerMark Wong <markwkm@gmail.com>2021-07-22 13:49:11 -0700
commita4cb4f7c9621df850827c7b48133c2162af16a14 (patch)
treeb00bcd10ee0d986acba677ee5baa52c2e1a17e0c
parentd54ff098664726c44b8dda21b814ed457774cd47 (diff)
Add Docker file and script to build AppImage
-rw-r--r--CMakeLists.txt32
-rw-r--r--Dockerfile.appimage48
-rw-r--r--HISTORY.rst5
-rw-r--r--Makefile7
-rw-r--r--docker/README4
-rwxr-xr-xdocker/appimage-build26
-rwxr-xr-xdocker/appimage-prepare14
7 files changed, 135 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4cf66e..508d020 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -395,3 +395,35 @@ add_custom_target(appimage
`ldd pg_top | grep libselinux.so | cut -d \" \" -f 3` AppDir/usr/lib
COMMAND VERSION=${PROJECT_VERSION} appimagetool-${ARCH}.AppImage AppDir
)
+
+add_custom_target(appimage-docker
+ COMMAND cp -aL ${CMAKE_SOURCE_DIR}/AppRun AppDir
+ COMMAND cp -aL ${CMAKE_SOURCE_DIR}/pg_top.desktop AppDir
+ COMMAND cp -aL ${CMAKE_SOURCE_DIR}/pg_top.png AppDir
+ COMMAND mkdir -p AppDir/usr/share/metainfo
+ COMMAND cp -aL ${CMAKE_SOURCE_DIR}/pg_top.appdata.xml AppDir/usr/share/metainfo
+ COMMAND mkdir -p AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libpq.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libtinfo.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libbsd.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libssl.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libcrypto.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libgssapi_krb5.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libkrb5.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libk5crypto.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libkrb5support.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libkeyutils.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND cp -aL
+ `ldd pg_top | grep libselinux.so | cut -d \" \" -f 3` AppDir/usr/lib
+ COMMAND VERSION=${PROJECT_VERSION} /usr/local/squashfs-root/AppRun --comp=xz AppDir
+)
diff --git a/Dockerfile.appimage b/Dockerfile.appimage
new file mode 100644
index 0000000..dd7a460
--- /dev/null
+++ b/Dockerfile.appimage
@@ -0,0 +1,48 @@
+# Build an environment for creating an AppImage.
+
+# Use a distro with an old libc to maximize support on as many linux distros as
+# possible.
+FROM centos:6
+
+# CentOS 6 is EOL so update the repo config to use the CentOS vault. 6.10 is
+# the final version.
+RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
+RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
+RUN sed -i 's|#baseurl=http://mirror.centos.org/centos/$releasever|baseurl=https://vault.centos.org/6.10|' /etc/yum.repos.d/*.repo
+
+RUN yum -y update
+RUN yum -y install epel-release
+RUN yum -y update
+RUN yum -y install cmake \
+ bison \
+ flex \
+ gcc \
+ libbsd-devel \
+ make \
+ ncurses-devel \
+ openssl-devel \
+ xz
+
+WORKDIR /usr/local
+# Release 12 is the latest that will run on CentOS 6.
+RUN curl -OL https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
+RUN chmod +x appimagetool-x86_64.AppImage
+RUN ./appimagetool-x86_64.AppImage --appimage-extract
+RUN chmod 0755 squashfs-root
+RUN chmod 0755 squashfs-root/usr
+RUN chmod 0755 squashfs-root/usr/bin
+RUN chmod 0755 squashfs-root/usr/lib
+RUN chmod 0755 squashfs-root/usr/lib/appimagekit
+RUN chmod 0755 squashfs-root/usr/share
+
+WORKDIR /usr/local/src
+
+# PostgreSQL 10 is the first release supporting multiple hosts in the
+# connection string.
+RUN curl -OL https://ftp.postgresql.org/pub/source/v10.17/postgresql-10.17.tar.bz2
+RUN tar xvf postgresql-10.17.tar.bz2
+WORKDIR /usr/local/src/postgresql-10.17
+RUN ./configure --without-ldap --without-readline --without-zlib \
+ --without-gssapi --with-openssl --prefix=/usr
+RUN make install
+RUN ldconfig
diff --git a/HISTORY.rst b/HISTORY.rst
index e46db03..a6ff715 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,11 @@
Release Notes
=============
+YYYY-MM-DD v4.0.1
+-----------------
+
+* Add Docker files for creating an AppImage
+
2020-08-05 v4.0.0
-----------------
diff --git a/Makefile b/Makefile
index 2ba1495..07a7811 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,18 @@ default:
UNAME_S := $(shell uname -s)
-appimage:
+appimage-prep:
cmake -H. -Bbuild/appimage -DCMAKE_INSTALL_PREFIX=/usr
cd build/appimage && make
cd build/appimage && sed -i -e 's#/usr#././#g' pg_top
cd build/appimage && make install DESTDIR=AppDir
+
+appimage: appimage-prep
cd build/appimage && make appimage
+appimage-docker: appimage-prep
+ cd build/appimage && make appimage-docker
+
clean:
-rm -rf build
diff --git a/docker/README b/docker/README
new file mode 100644
index 0000000..3f6947e
--- /dev/null
+++ b/docker/README
@@ -0,0 +1,4 @@
+This is a collection of scripts to use Docker for specific tasks:
+
+* appimage-prepare - Build a Docker image to use for creating an AppImage.
+* appimage-build - Create an AppImage for pg_top.
diff --git a/docker/appimage-build b/docker/appimage-build
new file mode 100755
index 0000000..e094692
--- /dev/null
+++ b/docker/appimage-build
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+which docker > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "docker is not in your path"
+ exit 1
+fi
+
+DOCKER_DIR=`dirname $0`
+DOCKER_DIR=`readlink -f $DOCKER_DIR`
+
+DOCKER_TAG="pg_top-appimage"
+
+# Use the return code from `docker inspect` to determine if the docker image
+# needs to be created.
+docker inspect $DOCKER_TAG > /dev/null
+if [ $? -ne 0 ]; then
+ ${DOCKER_DIR}/appimage-prepare || exit 1
+fi
+
+UID=`id -u`
+GID=`id -g`
+
+docker run --rm -v ${DOCKER_DIR}/..:/usr/local/src/pg_top:rw \
+ -w /usr/local/src/pg_top -u ${UID}:${GID} $DOCKER_TAG \
+ make appimage-docker
diff --git a/docker/appimage-prepare b/docker/appimage-prepare
new file mode 100755
index 0000000..8e1ae76
--- /dev/null
+++ b/docker/appimage-prepare
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+which docker > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "docker is not in your path"
+ exit 1
+fi
+
+DOCKER_DIR=`dirname $0`
+DOCKER_DIR=`readlink -f $DOCKER_DIR`
+
+DOCKER_TAG="pg_top-appimage"
+
+(cd $DOCKER_DIR/.. && docker build -t $DOCKER_TAG -f Dockerfile.appimage .)