FROM python:3.9-slim-bullseye

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1

RUN apt update
RUN apt install -y gcc git libbluetooth-dev bluez bluetooth
RUN apt clean

ADD requirements.txt .
RUN python -m pip install -U pip
RUN python -m pip install -Ur requirements.txt

RUN useradd -d /app -m appuser
WORKDIR /app
USER appuser

COPY get_data.py /app
COPY bluetooth_utils /app/bluetooth_utils
COPY entrypoint.sh /app

ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"]