diff --git a/Dockerfile b/Dockerfile index 33bea984..c6fcf95c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,30 @@ FROM node # Set ENV -ENV NODE_ENV production ENV PHANTOMJS_VERSION 2.1.1 # Commands -RUN apt-get update \ - #&& apt-get upgrade -y --force-yes \ - && apt-get install -y --force-yes --no-install-recommends \ - apt-utils \ - apt-transport-https \ - - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - - && apt-get update \ - && apt-get install -y --force-yes --no-install-recommends \ - yarn \ - wget \ - ca-certificates \ +RUN apt update && apt -y upgrade +RUN apt install -y \ libfreetype6 \ - libfontconfig \ - bzip2 \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get -y autoclean \ - && apt-get autoremove -y \ + libfontconfig - && 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 - -RUN tar -xjf /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C /tmp \ - && rm -rf /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 \ - && mkdir -p /srv/var \ - && mv /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/ /srv/var/phantomjs \ - && ln -s /srv/var/phantomjs/bin/phantomjs /usr/bin/phantomjs +RUN curl -OL https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \ + bunzip2 phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \ + tar -xf phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar && \ + rm -f phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar && \ + mv phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin/phantomjs /usr/bin/ && \ + rm -rf /var/www/phantomjs-$PHANTOMJS_VERSION-linux-x86_64 && \ + phantomjs --version # Create app directory RUN mkdir -p /usr/src/app +COPY . /usr/src/app WORKDIR /usr/src/app # Install app dependencies -COPY package.json /usr/src/app/ -RUN cd /usr/src/app/; yarn install --production - -# Bundle app source -COPY . /usr/src/app +RUN cd /usr/src/app && yarn install --production EXPOSE 3000 -CMD [ "npm", "start" ] + +CMD yarn start diff --git a/config/default.yaml b/config/default.yaml index 4450bc0e..873a712a 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -2,7 +2,7 @@ rasterizer: command: phantomjs # phantomjs executable port: 3001 # internal service port. No need to allow inbound or outbound access to this port host: '127.0.0.1' # host to listen on - path: /tmp # where the screenshot files are stored + path: /tmp/ # where the screenshot files are stored viewport: '1024x600' # browser window size. Height frows according to the content cache: lifetime: 60000 # one minute, set to 0 for no cache diff --git a/package.json b/package.json index 6f742766..e7dd7daa 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "screenshot-as-a-service", + "name": "capture", "description": "Website screenshot service powered by node.js and phantomjs", "version": "1.1.0", "repository": "https://github.com/fzaninotto/screenshot-as-a-service",