diff --git a/.buildpacks b/.buildpacks deleted file mode 100644 index 2bbb529..0000000 --- a/.buildpacks +++ /dev/null @@ -1,2 +0,0 @@ -git://github.com/heroku/heroku-buildpack-python.git -git://github.com/stomita/heroku-buildpack-phantomjs.git diff --git a/.gitignore b/.gitignore index 4123d6a..f12fe6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Custom +.vscode/ venv/ .env diff --git a/Dockerfile b/Dockerfile index ddf2df0..65790fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,14 @@ FROM python:3.7.4-slim-buster WORKDIR /sirius RUN apt-get update -y && \ - mkdir -p /usr/share/man/man1 && \ - mkdir -p /usr/share/man/man7 && \ + apt-get install -y --no-install-recommends \ + curl \ + gnupg + +RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add \ + && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list + +RUN apt-get update -y && \ apt-get install -y --no-install-recommends \ python3 \ python3-dev \ @@ -14,20 +20,27 @@ RUN apt-get update -y && \ libjpeg-dev \ libpq-dev \ zlib1g-dev \ - bzip2 \ fontconfig \ + fonts-dejavu \ + fonts-noto-color-emoji \ gcc \ - phantomjs \ - wget \ + google-chrome-stable \ postgresql-11 \ + unzip \ git RUN apt-get autoremove -y -RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -RUN tar jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && \ - rm phantomjs-2.1.1-linux-x86_64.tar.bz2 && \ - mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs +# Find the latest version for `chromedriver` that matches our installed `google-chrome` & install it to be available on $PATH +RUN COMMON_VERSION=$(google-chrome --version | sed -nre "s/.* ([0-9]+\.[0-9]+\.[0-9]+)/\1/p" | cut -d"." -f1-3) && \ + URL="https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${COMMON_VERSION}" && \ + CHROMEDRIVER_VERSION=$(curl -Ss "${URL}") && \ + CHROMEDRIVER_URL="https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" && \ + curl "${CHROMEDRIVER_URL}" -o "${HOME}/chromedriver_linux64.zip" && \ + unzip "${HOME}/chromedriver_linux64.zip" -d "${HOME}/" && \ + rm "${HOME}/chromedriver_linux64.zip" && \ + mv -f "${HOME}/chromedriver" /usr/local/bin/chromedriver && \ + chmod 0755 /usr/local/bin/chromedriver RUN pip install --upgrade pip diff --git a/app.json b/app.json new file mode 100644 index 0000000..29d1b19 --- /dev/null +++ b/app.json @@ -0,0 +1,37 @@ +{ + "name": "Sirius", + "description": "Sirius is a Little Printer server, give or take.", + "website": "https://littleprinter.nordprojects.co/", + "repository": "https://github.com/nordprojects/sirius", + "addons": [ + { + "plan": "heroku-postgresql", + "options": { + "version": "11.5" + } + } + ], + "image": "heroku/python", + "buildpacks": [ + { + "url": "heroku/google-chrome" + }, + { + "url": "heroku/chromedriver" + } + ], + "env": { + "FLASK_CONFIG": { + "description": "Deployment configuration", + "value": "heroku" + }, + "TWITTER_CONSUMER_KEY": { + "description": "Twitter app consumer key", + "required": true + }, + "TWITTER_CONSUMER_SECRET": { + "description": "Twitter app consumer secret", + "required": true + } + } +} diff --git a/sirius/coding/default_template.html b/sirius/coding/default_template.html index ef38bf3..fcb3b80 100644 --- a/sirius/coding/default_template.html +++ b/sirius/coding/default_template.html @@ -1,9 +1,10 @@ - +