Skip to content

Commit 9bde2f3

Browse files
committed
Enable Uvicorn reloading for local development
whythawk-full-stack-fastapi-postgresql#1 tiangolo/uvicorn-gunicorn-docker#1 tiangolo/uvicorn-gunicorn-docker#6 PR #1 updated the backend Docker image from https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker to https://github.com/br3ndonland/inboard (see https://inboard.bws.bio). The previous Docker image had a start-reload.sh script, which started Uvicorn with reloading. With inboard, there's no need for a separate script. The same effect can be achieved with environment variables (`PROCESS_MANAGER=uvicorn`, `WITH_RELOAD=true`).
1 parent cb293f2 commit 9bde2f3

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

{{cookiecutter.project_slug}}/backend/backend.dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ RUN bash -c "if [ $INSTALL_JUPYTER == 'true' ] ; then pip install jupyterlab ; f
1717

1818
ARG BACKEND_APP_MODULE=app.main:app
1919
ARG BACKEND_PRE_START_PATH=/app/prestart.sh
20-
ENV APP_MODULE=${BACKEND_APP_MODULE} PRE_START_PATH=${BACKEND_PRE_START_PATH}
20+
ARG BACKEND_PROCESS_MANAGER=gunicorn
21+
ARG BACKEND_WITH_RELOAD=false
22+
ENV APP_MODULE=${BACKEND_APP_MODULE} PRE_START_PATH=${BACKEND_PRE_START_PATH} PROCESS_MANAGER=${BACKEND_PROCESS_MANAGER} WITH_RELOAD=${BACKEND_WITH_RELOAD}
2123
COPY ./app/ /app/

{{cookiecutter.project_slug}}/docker-compose.override.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ services:
4949
args:
5050
BACKEND_APP_MODULE: ${BACKEND_APP_MODULE-app.main:app}
5151
BACKEND_PRE_START_PATH: ${BACKEND_PRE_START_PATH-/app/prestart.sh}
52+
BACKEND_PROCESS_MANAGER: ${BACKEND_PROCESS_MANAGER-uvicorn}
53+
BACKEND_WITH_RELOAD: ${BACKEND_WITH_RELOAD-true}
5254
INSTALL_DEV: ${INSTALL_DEV-true}
5355
INSTALL_JUPYTER: ${INSTALL_JUPYTER-true}
5456
labels:

{{cookiecutter.project_slug}}/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ services:
153153
args:
154154
BACKEND_APP_MODULE: ${BACKEND_APP_MODULE-app.main:app}
155155
BACKEND_PRE_START_PATH: ${BACKEND_PRE_START_PATH-/app/prestart.sh}
156+
BACKEND_PROCESS_MANAGER: ${BACKEND_PROCESS_MANAGER-gunicorn}
157+
BACKEND_WITH_RELOAD: ${BACKEND_WITH_RELOAD-false}
156158
INSTALL_DEV: ${INSTALL_DEV-false}
157159
deploy:
158160
labels:

0 commit comments

Comments
 (0)