Skip to content

Commit

Permalink
Update Dockerfile using last node image (yarn, curl, etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentClair committed Oct 14, 2017
1 parent bd90f50 commit 451d93e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 36 deletions.
48 changes: 14 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 451d93e

Please sign in to comment.