Skip to content

Commit cee6b5d

Browse files
committed
proper build with Makefile and binary artifact for phantomjs 2.11 alpine x86_64
1 parent f0aa2f2 commit cee6b5d

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
artifacts

Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM alpine:latest
22

33
ENV PHANTOMJS_VERSION 2.1.1
44
COPY *.patch /
5+
56
RUN apk add --no-cache --virtual .build-deps \
67
bison \
78
flex \
@@ -37,8 +38,11 @@ RUN apk add --no-cache --virtual .build-deps \
3738
&& patch -p1 -i /$i*.patch || break; \
3839
done \
3940
&& cd /usr/src/phantomjs \
40-
&& patch -p1 -i /build.patch \
41-
&& python build.py --confirm \
41+
&& patch -p1 -i /build.patch
42+
43+
# build phantomjs
44+
RUN cd /usr/src/phantomjs \
45+
&& python build.py --confirm \
4246
&& paxctl -cm bin/phantomjs \
4347
&& strip --strip-all bin/phantomjs \
4448
&& install -m755 bin/phantomjs /usr/bin/phantomjs \
@@ -53,3 +57,19 @@ RUN apk add --no-cache --virtual .build-deps \
5357
&& apk del .build-deps \
5458
&& rm -r /*.patch /usr/src
5559

60+
# package binary build
61+
RUN cd /root \
62+
&& apk add patchelf --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \
63+
&& mkdir -p phantomjs/lib \
64+
&& cp /usr/bin/phantomjs phantomjs/ \
65+
&& cd phantomjs \
66+
&& for lib in `ldd phantomjs \
67+
| awk '{if(substr($3,0,1)=="/") print $1,$3}' \
68+
| cut -d' ' -f2`; do \
69+
cp $lib lib/`basename $lib`; \
70+
done \
71+
&& patchelf --set-rpath lib phantomjs \
72+
&& cd /root \
73+
&& tar cvf phantomjs.tar phantomjs \
74+
&& bzip2 -9 phantomjs.tar
75+

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
NAME=artifacts/phantomjs-v2.11-alpine.tar.bz2
2+
all: $(NAME)
3+
4+
$(NAME):
5+
docker build -t phantomjs-alpine . && docker run --rm -i -v `pwd`/artifacts:/artifacts phantomjs-alpine:latest cp /root/phantomjs.tar.bz2 /$(NAME)
6+
7+
8+
clean:
9+
rm phantomjs-v2.11-alpine.tar.bz2
10+

0 commit comments

Comments
 (0)