Skip to content

Commit

Permalink
add seafile && phantomjs
Browse files Browse the repository at this point in the history
  • Loading branch information
yangxuan8282 committed Jan 31, 2017
1 parent 7ecd2a9 commit fe72343
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 0 deletions.
81 changes: 81 additions & 0 deletions rpi-alpine-phantomjs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
FROM hypriot/rpi-alpine-scratch:v3.3
MAINTAINER Yangxuan <yangxuan8282@gmail.com>

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

10 changes: 10 additions & 0 deletions rpi-alpine-phantomjs/Makefile
Original file line number Diff line number Diff line change
@@ -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"

37 changes: 37 additions & 0 deletions rpi-alpine-phantomjs/README.md
Original file line number Diff line number Diff line change
@@ -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
```
13 changes: 13 additions & 0 deletions rpi-alpine-phantomjs/build.patch
Original file line number Diff line number Diff line change
@@ -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()
Binary file added rpi-alpine-phantomjs/phantomjs.tar.bz2
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 56f45dce39476676df84d97586b67702988f69f1 Mon Sep 17 00:00:00 2001
From: Dave Flogeras <dflogeras2@gmail.com>
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 <glibc-2 specially
and all other libc implementations as POSIX.

This was found here http://patchwork.openembedded.org/patch/94947/ and
tested with armv6j-hardfloat-linux-uclibceabi and
armv6j-hardfloat-linux-musleabi.

Change-Id: I3850b1561a2e240f6564afedd80ce39407cc50b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
---
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

39 changes: 39 additions & 0 deletions rpi-alpine-phantomjs/qtwebkit-0001-Fix-musl-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 4e06c0bac4c7d0f75e5c1453313b2bf0b9df0145 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
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 <windows.h>
#endif

-#if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID)
+#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
#include <cxxabi.h>
#include <dlfcn.h>
#include <execinfo.h>
@@ -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

29 changes: 29 additions & 0 deletions rpi-alpine-seafile/README.md
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit fe72343

Please sign in to comment.