diff --git a/Makefile b/Makefile index 4462b90..ec74c09 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ REGISTRY_NAME=registry.runcible.io FRONTEND_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-frontend -FRONTEND_IMAGE_VERSION=1.1.0 +FRONTEND_IMAGE_VERSION=1.1.0-dev BACKEND_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-backend BACKEND_IMAGE_VERSION=1.1.0-dev diff --git a/backend/Dockerfile b/backend/Dockerfile index 8a997ca..88d7e72 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,6 +1,8 @@ # Base Image FROM python:3.10.0-buster +RUN apt-get update && apt-get install -y tini + ENV APP_HOME=/opt/app # Create directory for the app @@ -16,7 +18,7 @@ COPY requirements.txt . RUN pip install --no-cache -r requirements.txt # Install app -COPY app.py settings.py ./ +COPY src/* ./ # Chown all the files to the app user RUN chown -R app:app $APP_HOME @@ -24,4 +26,6 @@ RUN chown -R app:app $APP_HOME # Change to the app user USER app -CMD gunicorn --log-level=debug -b 0.0.0.0:5000 app:app +ENTRYPOINT ["/usr/bin/tini", "--"] + +CMD ["gunicorn", "--log-level=debug", "-b", "0.0.0.0:5000", "app:app"] diff --git a/backend/app.py b/backend/src/app.py similarity index 100% rename from backend/app.py rename to backend/src/app.py diff --git a/backend/src/entrypoint.sh b/backend/src/entrypoint.sh new file mode 100644 index 0000000..efd6d30 --- /dev/null +++ b/backend/src/entrypoint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# tell tini that it's a subreaper if we're exec'ing in +if [ "$$" -ne 1 ]; then + export TINI_SUBREAPER=true +fi + +# -g: Send signals to the child's process group. +exec tini -g -- "$@" \ No newline at end of file diff --git a/backend/settings.py b/backend/src/settings.py similarity index 100% rename from backend/settings.py rename to backend/src/settings.py