Skip to content

Commit

Permalink
add casperjs
Browse files Browse the repository at this point in the history
  • Loading branch information
vimagick committed Sep 13, 2015
1 parent a7638ef commit ef9113a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
32 changes: 32 additions & 0 deletions casperjs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Dockerfile for casperjs
#

FROM debian:jessie
MAINTAINER kev <[email protected]>

ENV PHANTOM_URL https://github.com/vimagick/dockerfiles/raw/master/webkit/bin/phantomjs
ENV CASPER_URL https://github.com/n1k0/casperjs/archive/master.tar.gz
ENV CASPER_DIR /usr/local/lib/casperjs/

RUN apt-get update \
&& apt-get install -y curl \
libfontconfig \
libicu52 \
python \
&& curl -sSL $PHANTOM_URL -o /usr/local/bin/phantomjs \
&& chmod +x /usr/local/bin/phantomjs \
&& mkdir -p $CASPER_DIR \
&& curl -sSL $CASPER_URL | tar xz --strip 1 -C $CASPER_DIR \
&& sed -i '/Warning PhantomJS v2.0 not yet released/s@^@//@' $CASPER_DIR/bin/bootstrap.js \
&& ln -sf $CASPER_DIR/bin/casperjs /usr/local/bin/ \
&& rm -rf /var/lib/apt/lists/*

COPY ./libjpeg.so.8 /usr/lib/x86_64-linux-gnu/
COPY ./sample.js /app/

VOLUME /app/
WORKDIR /app/

ENTRYPOINT ["casperjs"]
CMD ["--help"]
17 changes: 17 additions & 0 deletions casperjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
casperjs
========

[CasperJS][1] is a navigation scripting & testing utility for PhantomJS and SlimerJS
written in Javascript.

## Quick Start

```
$ alias casperjs='docker run --rm -v `pwd`:/app vimagick/casperjs'
$ wget https://raw.githubusercontent.com/vimagick/dockerfiles/master/casperjs/sample.js
$ casperjs sample.js
CasperJS, a navigation scripting and testing utility for PhantomJS and SlimerJS
PhantomJS | PhantomJS
```

[1]: http://casperjs.org/
Binary file added casperjs/libjpeg.so.8
Binary file not shown.
11 changes: 11 additions & 0 deletions casperjs/sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var casper = require('casper').create();

casper.start('http://casperjs.org/', function() {
this.echo(this.getTitle());
});

casper.thenOpen('http://phantomjs.org', function() {
this.echo(this.getTitle());
});

casper.run();

0 comments on commit ef9113a

Please sign in to comment.