From 1c4664aca86d0caf1bb49cfe0962634280666072 Mon Sep 17 00:00:00 2001 From: rrr-marble Date: Fri, 8 Jul 2022 23:59:47 +0300 Subject: [PATCH] add: wait for alembic to apply changes --- docker/Dockerfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f6888a3..2809a3e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,14 +8,19 @@ RUN pip install wheel RUN pip install -r /app/geodata/requirements.txt RUN pip install gunicorn uvicorn +RUN curl --location https://raw.githubusercontent.com/vishnubob/wait-for-it/81b1373f17855a4dc21156cfe1694c31d7d1792e/wait-for-it.sh > /usr/bin/wait-for-it \ + && chmod +x /usr/bin/wait-for-it + EXPOSE 8000 WORKDIR /app CMD [ \ - "gunicorn", \ - "--workers=2", \ - "--worker-class=uvicorn.workers.UvicornWorker", \ - "--bind=0.0.0.0:8000", \ + "/usr/bin/wait-for-it", "postgres:5432", "--timeout=45", "--strict", \ + "--", \ + # might use exact migration hash here instead of upgrading to the latest "heads" + "alembic", "upgrade", "heads", \ + "&&", \ + "gunicorn", "--workers=2", "--worker-class=uvicorn.workers.UvicornWorker", "--bind=0.0.0.0:8000", \ "geodata.main:app" \ ] \ No newline at end of file