zopanix / docker_casperjs

CasperJS in a docker container.
MIT License
2 stars 8 forks source link

Building from Dockerfile #2

Open thebetterjort opened 7 years ago

thebetterjort commented 7 years ago

CasperJS needs at least PhantomJS v1.9.1 or later. [info] [phantom] Starting... [info] [phantom] Running suite: 3 steps

Is the build failing on phantomJS?

zopanix commented 7 years ago

Can you be a bit more specific on the what you are doing ?

thebetterjort commented 7 years ago

docker run -v $(pwd):/data zopanix/casperjs /data/casper.js --web-security=no --ssl-protocol=any --ignore-ssl-errors=yes --city=AR --output=XML --filename=latest.xml

Trying to run a script. If I run from your docker from registry it works without a problem. When I copy down your Dockerfile it fails.

zopanix commented 7 years ago

What does the docker build command output?

thebetterjort commented 7 years ago

CasperJS needs at least PhantomJS v1.9.1 or later. [info] [phantom] Starting... [info] [phantom] Running suite: 3 steps

zopanix commented 7 years ago

This seems more of a run command then a build command. If you clone my repo (the whole repo, not just the Dockerfile) and inside the repository folder you run the following command: docker build -t casperjs . What's the output of that ?

thebetterjort commented 7 years ago

It gives me success with an image Id. But I think I get some errors. Let me run again.

thebetterjort commented 7 years ago

Think it's not building because of corporate proxy.

thebetterjort commented 7 years ago

Step 1 : FROM ubuntu:14.04.4 ---> 0ccb13bf1954 Step 2 : MAINTAINER zopanix zopanix@gmail.com ---> Using cache ---> ac232edd6786 Step 3 : ENV CASPERJS_VERSION 1.1.3 ---> Using cache ---> f5bc03a3d1d3 Step 4 : ADD ./resources /resources ---> Using cache ---> 2ae1a8951315 Step 5 : RUN /resources/build && rm -rf resources ---> Using cache ---> f70238b3e641 Step 6 : ENTRYPOINT casperjs ---> Using cache ---> 05a1df786869 Step 7 : VOLUME /data ---> Using cache ---> f217924e26b1 Step 8 : WORKDIR /data ---> Using cache ---> c35e168ae7a5 Successfully built c35e168ae7a5

zopanix commented 7 years ago

This isn't really helpfull because you're using a cached layer for the building part. Can you put your output for the following command : docker built -t casperjs . - no-cache I'll be able to help you better

thebetterjort commented 7 years ago

These items are listed in red when I try and build.

Setting up unattended-upgrades (0.82.1ubuntu2.4) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline debconf: unable to initialize frontend: Readline debconf: (This frontend requires a controlling tty.) debconf: falling back to frontend: Teletype

debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline debconf: unable to initialize frontend: Readline debconf: (This frontend requires a controlling tty.) debconf: falling back to frontend: Teletype dpkg-preconfigure: unable to re-open stdin:

Setting up rsync (3.1.0-2ubuntu0.2) ... Removing any system startup links for /etc/init.d/rsync ... update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match rsync Default-Stop values (none) Adding system startup for /etc/init.d/rsync ... /etc/rc0.d/K20rsync -> ../init.d/rsync /etc/rc1.d/K20rsync -> ../init.d/rsync /etc/rc6.d/K20rsync -> ../init.d/rsync /etc/rc2.d/S20rsync -> ../init.d/rsync /etc/rc3.d/S20rsync -> ../init.d/rsync /etc/rc4.d/S20rsync -> ../init.d/rsync /etc/rc5.d/S20rsync -> ../init.d/rsync invoke-rc.d: policy-rc.d denied execution of restart.

Cloning into 'casperjs'... Note: checking out '1.1.3'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at cd78443... Release 1.1.3

Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: git 0 upgraded, 0 newly installed, 1 to remove and 38 not upgraded. After this operation, 20.5 MB disk space will be freed. (Reading database ... 15097 files and directories currently installed.) Removing git (1:1.9.1-1ubuntu0.3) ... ---> 5f9d82ca90f8 Removing intermediate container 7dc8a4617e09 Step 6 : ENTRYPOINT casperjs ---> Running in 99566ee9247f ---> d23a07d42315 Removing intermediate container 99566ee9247f Step 7 : VOLUME /data ---> Running in bbfa7b71f99b ---> 2e7d9efa35d2 Removing intermediate container bbfa7b71f99b Step 8 : WORKDIR /data ---> Running in ec81876c04a3 ---> 6af1e88b2c77 Removing intermediate container ec81876c04a3 Successfully built 6af1e88b2c77

Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: git 0 upgraded, 0 newly installed, 1 to remove and 38 not upgraded. After this operation, 20.5 MB disk space will be freed. (Reading database ... 15097 files and directories currently installed.) Removing git (1:1.9.1-1ubuntu0.3) ... ---> 5f9d82ca90f8 Removing intermediate container 7dc8a4617e09 Step 6 : ENTRYPOINT casperjs ---> Running in 99566ee9247f ---> d23a07d42315 Removing intermediate container 99566ee9247f Step 7 : VOLUME /data ---> Running in bbfa7b71f99b ---> 2e7d9efa35d2 Removing intermediate container bbfa7b71f99b Step 8 : WORKDIR /data ---> Running in ec81876c04a3 ---> 6af1e88b2c77 Removing intermediate container ec81876c04a3 Successfully built 6af1e88b2c77

zopanix commented 7 years ago

Yeah I have that to but that's not what's cause it not to work

thebetterjort commented 7 years ago

docker run -v $(pwd):/data casperjs /data/casper.js --web-security=no --ssl-protocol=any --ignore-ssl-errors=yes --city=AR --output=XML --filename=latest.xml

CasperJS needs at least PhantomJS v1.9.1 or later. [info] [phantom] Starting... [info] [phantom] Running suite: 3 steps

thebetterjort commented 7 years ago

docker run -v $(pwd):/data zopanix/casperjs /data/casper.js --web-security=no --ssl-protocol=any --ignore-ssl-errors=yes --city=AR --output=XML --filename=latest.xml

[debug] [phantom] opening url: https://localhost/directory.fwx, HTTP GET [debug] [phantom] Navigation requested: url=https://localhost/directory.fwx, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] url changed to "https://localhost/directory.fwx" [debug] [phantom] Successfully injected Casper client-side utilities debug] [remote] sendAJAX(): Using HTTP method: 'GET' [debug] [phantom] Downloaded and saved resource in /data/latest.xml [debug] [remote] sendAJAX(): Using HTTP method: 'GET' [info] [phantom] Step anonymous 3/3: done in 6831ms.

[info] [phantom] Done 3 steps in 6832ms

thebetterjort commented 7 years ago

I want to add a cronjob that runs my script every week. I can probably get around this. Just really stumped..

zopanix commented 7 years ago

I don't know what's happening to be honest. This should be working exaclty the same... Can you try these commands: docker run --rm -it --entrypoint bash casperjs This will prompt you with a bash and execute: phantomjs --version and casperjs --version

zopanix commented 7 years ago

I'm off for the day, I'll look a bit at it in tomorrow morning

thebetterjort commented 7 years ago

casperjs --version = 1.1.2 phantomjs --version = 1.9.0

casperjs --version CasperJS needs at least PhantomJS v1.9.1 or later. 1.1.2

Looks like I need phantomJS 1.9.1 and I'm only getting 1.9.0

zopanix commented 7 years ago

Okay, that's weird. I'll check it tomorrow to see if I can debug. The thing is phantom j's didn't build binaries for 1.9.x so I used a Debien package from a former colleague. He might have changed some thing on his end. If that's the case I'll have to redo the old fashion way and compile phantomjs in the container build. Which is a pain because you basically download the whole internet just to build it and cleaning afterwards is kind of hard. The cleaning is needed to make smaller images. I'll certainly look into it.

In the meanwhile if you need to make a cron, don't do it inside the container but on the host. Just cron the docker run command instead of having a container running all the time. If the container fails it will stay down. The cron will be more reliable

thebetterjort commented 7 years ago

@zopanix Thank you for your tip on cron. I'm trying to make this project more mobile, noob friendly. Do you still think cron on the host is best case scenerio?

Still getting the error.