davidofwatkins / ge-cancellation-checker

A PhantomJS script that checks your GOES account for a sooner Global Entry enrollment appointment
173 stars 74 forks source link

config file cannot be found (using Docker to run the scripts) #33

Open lfaller opened 7 years ago

lfaller commented 7 years ago

Hi all,

I ran the code according to the Docker instructions but the script cannot find the config.json file even though it's in the main directory.

$> ls -la
total 56
drwxrwxrwx 3 nobody nogroup 4096 Feb  8 11:08 .
drwxrwxrwx 9 nobody nogroup 4096 Feb  8 10:57 ..
-rwxrwxrwx 1 nobody nogroup  714 Feb  8 11:08 config.json
-rwxrwxrwx 1 nobody nogroup  586 Feb  8 10:57 config.json.example
-rwxrwxrwx 1 nobody nogroup 1150 Feb  8 10:57 CONTRIBUTING.md
-rwxrwxrwx 1 nobody nogroup 1037 Feb  8 10:57 Dockerfile
-rwxrwxrwx 1 nobody nogroup 6914 Feb  8 10:57 ge-cancellation-checker.phantom.js
-rwxrwxrwx 1 nobody nogroup 7743 Feb  8 10:57 ge-checker-cron.py
drwxrwxrwx 8 nobody nogroup 4096 Feb  8 10:57 .git
-rwxrwxrwx 1 nobody nogroup   18 Feb  8 10:57 .gitignore
-rwxrwxrwx 1 nobody nogroup 6736 Feb  8 10:57 README.md
$> docker build -t ge-cancellation-checker .
Sending build context to Docker daemon   127 kB
Step 1/7 : FROM ubuntu:12.04
 ---> f0d07a756afd
Step 2/7 : ENV PHANTOMJS_VERSION 1.9.7
 ---> Using cache
 ---> bcc03145c179
Step 3/7 : RUN apt-get update &&   apt-get upgrade -y &&   apt-get install -y vim git wget libfreetype6 libfontconfig bzip2 &&   mkdir -p /srv/var &&   wget -q --no-check-certificate -O /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 &&   tar -xjf /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C /tmp &&   rm -f /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 &&   mv /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/ /srv/var/phantomjs &&   ln -s /srv/var/phantomjs/bin/phantomjs /usr/bin/phantomjs &&   git clone https://github.com/n1k0/casperjs.git /srv/var/casperjs &&   ln -s /srv/var/casperjs/bin/casperjs /usr/bin/casperjs &&   apt-get autoremove -y &&   apt-get clean all
 ---> Using cache
 ---> 2b1f28beb2a8
Step 4/7 : ADD . /opt/ge_checker
 ---> Using cache
 ---> d424237315f4
Step 5/7 : VOLUME /logs
 ---> Using cache
 ---> 70fdb5f38cc5
Step 6/7 : WORKDIR /opt/ge_checker
 ---> Using cache
 ---> 2a0f60430828
Step 7/7 : CMD /usr/bin/phantomjs --ssl-protocol=any ge-cancellation-checker.phantom.js -v
 ---> Using cache
 ---> 186f5a6ccb72
Successfully built 186f5a6ccb72
$> docker run ge-cancellation-checker
Could not find ./config.json
$>

Still a bit new to Docker... do I have to set up a special mount point for the docker container to find the config file?

Thanks for any advice!

EpochalEngineer commented 7 years ago

Ran into this too, also new to docker, turns out it's unrelated. For me something wasn't formatted right in my config.json. Run ge-checker-cron.py outside of docker and you should get the correct error. The parsing happens before the complaint about phantomjs not being installed.

The phantomjs script has some sort of catchall error response that isn't helpful.

You need to docker re-build after updating any files, including config.json