diff --git a/rpi-alpine-phantomjs/Dockerfile b/rpi-alpine-phantomjs/Dockerfile new file mode 100644 index 0000000..ce931dd --- /dev/null +++ b/rpi-alpine-phantomjs/Dockerfile @@ -0,0 +1,81 @@ +FROM hypriot/rpi-alpine-scratch:v3.3 +MAINTAINER Yangxuan + +ENV PHANTOMJS_VERSION 2.1.1 +COPY *.patch / + +RUN sed -i 's/nl.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories + +RUN apk update \ + && apk upgrade \ + && apk add --no-cache --virtual .build-deps \ + bison \ + flex \ + fontconfig-dev \ + freetype-dev \ + g++ \ + gcc \ + git \ + gperf \ + icu-dev \ + libc-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libx11-dev \ + libxext-dev \ + linux-headers \ + make \ + openssl-dev \ + paxctl \ + perl \ + python \ + ruby \ + sqlite-dev \ + && mkdir -p /usr/src \ + && cd /usr/src \ + && git clone git://github.com/ariya/phantomjs.git \ + && cd phantomjs \ + && git checkout $PHANTOMJS_VERSION \ + && git submodule init \ + && git submodule update \ + && for i in qtbase qtwebkit; do \ + cd /usr/src/phantomjs/src/qt/$i \ + && patch -p1 -i /$i*.patch || break; \ + done \ + && cd /usr/src/phantomjs \ + && patch -p1 -i /build.patch + +# build phantomjs +RUN cd /usr/src/phantomjs \ + && python build.py --confirm \ + && paxctl -cm bin/phantomjs \ + && strip --strip-all bin/phantomjs \ + && install -m755 bin/phantomjs /usr/bin/phantomjs \ + && runDeps="$( \ + scanelf --needed --nobanner /usr/bin/phantomjs \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --virtual .phantomjs-rundeps $runDeps \ + && apk del .build-deps \ + && rm -r /*.patch /usr/src + +RUN apk add patchelf --update-cache --repository https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/community/ --allow-untrusted + +# package binary build +RUN cd /root \ + && mkdir -p phantomjs/lib \ + && cp /usr/bin/phantomjs phantomjs/ \ + && cd phantomjs \ + && for lib in `ldd phantomjs \ + | awk '{if(substr($3,0,1)=="/") print $1,$3}' \ + | cut -d' ' -f2`; do \ + cp $lib lib/`basename $lib`; \ + done \ + && patchelf --set-rpath '$ORIGIN/lib' phantomjs \ + && cd /root \ + && tar cvf phantomjs.tar phantomjs \ + && bzip2 -9 phantomjs.tar + diff --git a/rpi-alpine-phantomjs/Makefile b/rpi-alpine-phantomjs/Makefile new file mode 100644 index 0000000..fd7d8aa --- /dev/null +++ b/rpi-alpine-phantomjs/Makefile @@ -0,0 +1,10 @@ +NAME=artifacts/phantomjs-alpine-x86_64.tar.bz2 +all: $(NAME) + +$(NAME): + docker build -t phantomjs-alpine . && docker run --rm -i -v `pwd`/artifacts:/artifacts phantomjs-alpine:latest cp /root/phantomjs.tar.bz2 /$(NAME) + + +clean: + rm artifacts/* 2>/dev/null || echo "clean" + diff --git a/rpi-alpine-phantomjs/README.md b/rpi-alpine-phantomjs/README.md new file mode 100644 index 0000000..f816171 --- /dev/null +++ b/rpi-alpine-phantomjs/README.md @@ -0,0 +1,37 @@ +phantomjs docker for Raspberry Pi +--- + +[![](https://images.microbadger.com/badges/image/yangxuan8282/rpi-alpine-phantomjs.svg)](https://microbadger.com/images/yangxuan8282/rpi-alpine-phantomjs "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/yangxuan8282/rpi-alpine-phantomjs.svg)](https://microbadger.com/images/yangxuan8282/rpi-alpine-phantomjs "Get your own version badge on microbadger.com") + +### FROM + +steal from [Overbryd/docker-phantomjs-alpine](https://github.com/Overbryd/docker-phantomjs-alpine) + +base images: hypriot/rpi-alpine-scratch:v3.3 + +### BUILD + +- 2 GB swap + +- 4-5 hours + +- 1.7 GB image + +### RUN + +extract binary file: + +```bash +docker run -t yangxuan8282/rpi-alpine-phantomjs cat /root/phantomjs.tar.bz2 > phantomjs.tar.bz2 +``` + +Include the binary in your Alpine Dockerfile like this: + +```bash +RUN apk update && apk add --no-cache fontconfig && \ + mkdir -p /usr/share && \ + cd /usr/share \ + && curl -L URL | tar xj \ + && ln -s /usr/share/phantomjs/phantomjs /usr/bin/phantomjs \ + && phantomjs --version +``` diff --git a/rpi-alpine-phantomjs/build.patch b/rpi-alpine-phantomjs/build.patch new file mode 100644 index 0000000..a9ef69a --- /dev/null +++ b/rpi-alpine-phantomjs/build.patch @@ -0,0 +1,13 @@ +diff --git a/build.py b/build.py +index bf06752..acd92ce 100755 +--- a/build.py ++++ b/build.py +@@ -353,7 +353,7 @@ class PhantomJSBuilder(object): + + # run all build steps required to get a final PhantomJS binary at the end + def run(self): +- self.ensureSubmodulesAvailable(); ++# self.ensureSubmodulesAvailable(); + self.buildQtBase() + self.buildQtWebKit() + self.buildPhantomJS() diff --git a/rpi-alpine-phantomjs/phantomjs.tar.bz2 b/rpi-alpine-phantomjs/phantomjs.tar.bz2 new file mode 100644 index 0000000..49f95dc Binary files /dev/null and b/rpi-alpine-phantomjs/phantomjs.tar.bz2 differ diff --git a/rpi-alpine-phantomjs/qtbase-0001-Fix-for-platform-socklen_t-on-other-C-libraries-than.patch b/rpi-alpine-phantomjs/qtbase-0001-Fix-for-platform-socklen_t-on-other-C-libraries-than.patch new file mode 100644 index 0000000..e436fe4 --- /dev/null +++ b/rpi-alpine-phantomjs/qtbase-0001-Fix-for-platform-socklen_t-on-other-C-libraries-than.patch @@ -0,0 +1,40 @@ +From 56f45dce39476676df84d97586b67702988f69f1 Mon Sep 17 00:00:00 2001 +From: Dave Flogeras +Date: Tue, 29 Sep 2015 08:52:31 -0300 +Subject: [PATCH] Fix for platform socklen_t on other C libraries than glibc. + +Rather than treating >=glibc-2 specially, we treat +Reviewed-by: Thiago Macieira +--- + mkspecs/linux-g++/qplatformdefs.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/mkspecs/linux-g++/qplatformdefs.h b/mkspecs/linux-g++/qplatformdefs.h +index 5c18632..95a5758 100644 +--- a/mkspecs/linux-g++/qplatformdefs.h ++++ b/mkspecs/linux-g++/qplatformdefs.h +@@ -78,10 +78,10 @@ + + #undef QT_SOCKLEN_T + +-#if defined(__GLIBC__) && (__GLIBC__ >= 2) +-#define QT_SOCKLEN_T socklen_t +-#else ++#if defined(__GLIBC__) && (__GLIBC__ < 2) + #define QT_SOCKLEN_T int ++#else ++#define QT_SOCKLEN_T socklen_t + #endif + + #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) +-- +2.7.2 + diff --git a/rpi-alpine-phantomjs/qtwebkit-0001-Fix-musl-build.patch b/rpi-alpine-phantomjs/qtwebkit-0001-Fix-musl-build.patch new file mode 100644 index 0000000..b036a2a --- /dev/null +++ b/rpi-alpine-phantomjs/qtwebkit-0001-Fix-musl-build.patch @@ -0,0 +1,39 @@ +From 4e06c0bac4c7d0f75e5c1453313b2bf0b9df0145 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Fri, 26 Feb 2016 13:17:12 +0000 +Subject: [PATCH] Fix musl build + +Only enable the GNU extension backtrace on GNU systems. + +This is fixed in upstream with https://github.com/WebKit/webkit/commit/a225c6c061db1b3dfe91af8ac530e3d14c972a41 + +Issue: https://github.com/ariya/phantomjs/issues/14043 +--- + Source/WTF/wtf/Assertions.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp +index 1b2091f..4600720 100644 +--- a/Source/WTF/wtf/Assertions.cpp ++++ b/Source/WTF/wtf/Assertions.cpp +@@ -61,7 +61,7 @@ + #include + #endif + +-#if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID) ++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)) + #include + #include + #include +@@ -245,7 +245,7 @@ void WTFReportArgumentAssertionFailure(const char* file, int line, const char* f + + void WTFGetBacktrace(void** stack, int* size) + { +-#if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID) ++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)) + *size = backtrace(stack, *size); + #elif OS(WINDOWS) && !OS(WINCE) + // The CaptureStackBackTrace function is available in XP, but it is not defined +-- +2.7.2 + diff --git a/rpi-alpine-seafile/README.md b/rpi-alpine-seafile/README.md new file mode 100644 index 0000000..e8592c0 --- /dev/null +++ b/rpi-alpine-seafile/README.md @@ -0,0 +1,29 @@ +seafile docker for Raspberry Pi +--- + +[![](https://images.microbadger.com/badges/image/yangxuan8282/rpi-alpine-seafile.svg)](https://microbadger.com/images/yangxuan8282/rpi-alpine-seafile "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/yangxuan8282/rpi-alpine-seafile.svg)](https://microbadger.com/images/yangxuan8282/rpi-alpine-seafile "Get your own version badge on microbadger.com") + +### FROM + +steal from [VGoshev/seafile-docker](https://github.com/VGoshev/seafile-docker) + +base images: hypriot/rpi-alpine-scratch:v3.4 + +### RUN + +```bash +install -dm777 $HOME/seafile && +docker run --name seafile \ + -v $HOME/seafile:/home/seafile \ + -p 192.168.8.103:8000:8000 \ + -p 192.168.8.103:8082:8082 \ + -ti yangxuan8282/rpi-alpine-seafile +``` + +>replace `192.168.8.103` with your raspberry pi IP address + +then configure admin email and password + +web: visit http://raspberrypi:8000 (or replace `raspberrypi` with your hostname/IP address) + +app: http://raspberrypi:8000, email, password (or replace `raspberrypi` with your hostname/IP address)