FROM debian:bookworm-slim # Install Python and curl RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \ apt-get update && apt-get install -y python3 python3-pip python3-venv curl # Create and activate a virtual environment RUN python3 -m venv /app/venv ENV PATH="/app/venv/bin:$PATH" # Install dependencies with venv COPY requirements.txt /app/requirements.txt RUN /app/venv/bin/pip install -r /app/requirements.txt # Copy the application COPY main.py /app COPY utils/ /app/utils WORKDIR /app # Run the application CMD ["/app/venv/bin/python", "main.py"] # Healthcheck HEALTHCHECK --interval=5s --timeout=10s --retries=5 --start-period=5s CMD curl -f http://localhost:9092/heartbeat || exit 1