From 19014bcecd0119f8f5538f312792052749d4619d Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Wed, 18 Oct 2023 22:09:46 -0400 Subject: [PATCH] refactor: use heroku.yml and run migrations in release phase (#50) --- Procfile | 1 - heroku.Dockerfile | 20 ++++++++++++++++++++ heroku.yml | 9 +++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) delete mode 100644 Procfile create mode 100644 heroku.Dockerfile create mode 100644 heroku.yml diff --git a/Procfile b/Procfile deleted file mode 100644 index 50d149b..0000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -index-regen: python main.py diff --git a/heroku.Dockerfile b/heroku.Dockerfile new file mode 100644 index 0000000..0e8586b --- /dev/null +++ b/heroku.Dockerfile @@ -0,0 +1,20 @@ +FROM python:3.9 + +# Install dependencies +RUN apt-get update +RUN apt-get install curl libpq-dev postgresql-client nodejs yarnpkg -y + +# Set working directory +WORKDIR /home/indexer + +# Copy source code +COPY . . + +# Install indexer and pin the version of poetry +RUN pip3 install poetry==1.6.1 +RUN poetry install +# the heroku.yml 'run' directive is incompatible with poetry +# so we export to the requirements.txt format and use pip3 +RUN poetry export --without-hashes --format=requirements.txt > requirements.txt +RUN pip3 install -r requirements.txt +RUN yarnpkg install diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..837d9fe --- /dev/null +++ b/heroku.yml @@ -0,0 +1,9 @@ +build: + docker: + indexer: heroku.Dockerfile +run: + indexer: python main.py +release: + image: indexer + command: + - PGSSLMODE=no-verify yarnpkg migrate