From cfc6127f68768281babf99695e6982bfcd191cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Sverre=20Lien=20Sell=C3=A6g?= Date: Tue, 19 May 2020 19:21:28 +0200 Subject: [PATCH] add docker image with instructions on how to use --- .gitignore | 1 + Dockerfile | 23 +++++++++++++++++++++++ README.md | 20 ++++++++++++++++++-- scrape.sh | 7 +++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100755 scrape.sh diff --git a/.gitignore b/.gitignore index 042ccf2..7789f50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules *~ +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..96a864c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:14.2-alpine +MAINTAINER Jørgen Sverre Lien Sellæg + +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ + PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser + +RUN apk add --no-cache \ + chromium \ + bash \ + imagemagick \ + graphicsmagick \ + nss \ + freetype \ + freetype-dev \ + harfbuzz \ + ca-certificates \ + ttf-freefont + +WORKDIR "/app" +USER node +COPY --chown=node:node ./scrape.sh /scrape.sh + +CMD ["/scrape.sh"] diff --git a/README.md b/README.md index 905b941..9e29f85 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,20 @@ -# Kultar - event calendar +# Facebook event scraper + +A simple facebook event scraper written with puppeteer ## Introduction -This is an simple application that should scrape facebook events from kulturvarsel page on facebook + +Please note that terms and condition apply from facebook and this should only be +used if written consent is provided by facebook. However it will work without. + +## Usage + +### Alpine docker image is provided + +```sh +docker build --tag facebook-scraper . +docker run \ + -v "$(pwd):/app" \ + --cap-add SYS_ADMIN \ + facebook-scraper +``` diff --git a/scrape.sh b/scrape.sh new file mode 100755 index 0000000..c0edab9 --- /dev/null +++ b/scrape.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if ! [ -d node_modules ]; then + yarn +fi + +exec node scrape.js