From 6900b9053c3e45a94823adb5138c12e0752fea5c Mon Sep 17 00:00:00 2001 From: pictuga Date: Sun, 21 Nov 2021 21:57:06 +0100 Subject: [PATCH] Heroku click to deploy incl. workaround for their weird use of entrypoint --- Dockerfile | 3 ++- README.md | 2 ++ app.json | 1 + docker-entry.sh | 6 +++--- heroku.yml | 9 +++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 app.json create mode 100644 heroku.yml diff --git a/Dockerfile b/Dockerfile index 6a22947..5c63992 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,5 @@ RUN pip3 install --no-cache-dir /app[full] gunicorn USER 1000:1000 -ENTRYPOINT ["/app/docker-entry.sh"] +ENTRYPOINT ["/bin/sh", "/app/docker-entry.sh"] +CMD ["run"] diff --git a/README.md b/README.md index 5ad1035..526135a 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,8 @@ Then execute docker-compose build --no-cache --pull ``` +One-click Heroku deployment: https://heroku.com/deploy?template=https://github.com/pictuga/morss + ## Run morss will auto-detect what "mode" to use. diff --git a/app.json b/app.json new file mode 100644 index 0000000..7d2d73b --- /dev/null +++ b/app.json @@ -0,0 +1 @@ +{"stack": "container"} diff --git a/docker-entry.sh b/docker-entry.sh index aa7122a..620ff44 100755 --- a/docker-entry.sh +++ b/docker-entry.sh @@ -1,7 +1,7 @@ #! /bin/sh -if [ ! -z "$1" ]; then - morss $@ +if [ -z "$1" ] || [ "$@" = "run" ]; then + gunicorn --bind 0.0.0.0:${PORT:-8000} -w 4 --preload --access-logfile - morss else - gunicorn --bind 0.0.0.0:8000 -w 4 --preload --access-logfile - morss + morss $@ fi diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..b3bff17 --- /dev/null +++ b/heroku.yml @@ -0,0 +1,9 @@ +setup: + config: + DEBUG: 1 + CACHE: diskcache + CACHE_SIZE: 1073741824 + +build: + docker: + web: Dockerfile