Using tini for init on backend

master
Drew Bednar 3 years ago
parent ab89389c1a
commit d1fc54f9b1

@ -1,6 +1,6 @@
REGISTRY_NAME=registry.runcible.io REGISTRY_NAME=registry.runcible.io
FRONTEND_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-frontend 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_NAME=$(REGISTRY_NAME)/demo-helm-backend
BACKEND_IMAGE_VERSION=1.1.0-dev BACKEND_IMAGE_VERSION=1.1.0-dev

@ -1,6 +1,8 @@
# Base Image # Base Image
FROM python:3.10.0-buster FROM python:3.10.0-buster
RUN apt-get update && apt-get install -y tini
ENV APP_HOME=/opt/app ENV APP_HOME=/opt/app
# Create directory for the app # Create directory for the app
@ -16,7 +18,7 @@ COPY requirements.txt .
RUN pip install --no-cache -r requirements.txt RUN pip install --no-cache -r requirements.txt
# Install app # Install app
COPY app.py settings.py ./ COPY src/* ./
# Chown all the files to the app user # Chown all the files to the app user
RUN chown -R app:app $APP_HOME RUN chown -R app:app $APP_HOME
@ -24,4 +26,6 @@ RUN chown -R app:app $APP_HOME
# Change to the app user # Change to the app user
USER app 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"]

@ -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 -- "$@"
Loading…
Cancel
Save