From d5e401c358e03ef13dafd9be3adb522a5027ac74 Mon Sep 17 00:00:00 2001 From: Kendrick Bollens Date: Fri, 30 Jan 2026 00:26:08 +0100 Subject: [PATCH] we can now build a docker container from it --- dockerfile | 20 ++++++++++++++++++++ entrypoint.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 dockerfile create mode 100755 entrypoint.sh diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..83a4fb2 --- /dev/null +++ b/dockerfile @@ -0,0 +1,20 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Install Flask (sqlite3 is built into Python) +RUN pip install --no-cache-dir flask + +# Copy application files +COPY starface_call_logger.py . +COPY dashboard.py . +COPY entrypoint.sh . + +# Make entrypoint executable +RUN chmod +x entrypoint.sh + +# Expose both ports +EXPOSE 5000 5001 + +# Run the entrypoint script +CMD ["./entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..7695b5b --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash +set -e + +echo "Starting Room Cleaning Tracker..." + +# Start the POST logger in background +python starface_call_logger.py & +LOGGER_PID=$! + +# Start the dashboard in background +python dashboard.py & +DASHBOARD_PID=$! + +# Function to kill both on exit +cleanup() { + echo "Shutting down..." + kill $LOGGER_PID $DASHBOARD_PID 2>/dev/null || true + exit 1 +} + +trap cleanup SIGTERM SIGINT + +# Monitor both processes +while true; do + # Check if logger is still running + if ! kill -0 $LOGGER_PID 2>/dev/null; then + echo "ERROR: Logger crashed!" + kill $DASHBOARD_PID 2>/dev/null || true + exit 1 + fi + + # Check if dashboard is still running + if ! kill -0 $DASHBOARD_PID 2>/dev/null; then + echo "ERROR: Dashboard crashed!" + kill $LOGGER_PID 2>/dev/null || true + exit 1 + fi + + sleep 2 +done