diff --git a/Dockerfile b/Dockerfile index 5c94812..d7619cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.11 +# TODO: investigate using -alpine in the future +FROM python:3.11 WORKDIR /usr/src/app @@ -12,10 +13,14 @@ RUN --mount=type=cache,target=/root/.cache \ --mount=type=ssh,required=true \ pip install ./ -#CMD [ "python", "./your-daemon-or-script.py" ] - # make sure to install sudo apt install docker-buildx # make sure to set IdentityFile /home/pstruebi/.ssh/id_ed25519 in ~/.ssh/config -maybe not nececcary # example build commands: + # docker build --ssh default . -# docker build --ssh default=~/.ssh/id_rsa . \ No newline at end of file +# docker build --ssh default=~/.ssh/id_rsa . +# docker build --ssh default -t bumble-auracast:latest . + +# example run commands +# interactive: +# docker run --rm -it --device /dev/serial/by-id/usb-ZEPHYR_Zephyr_HCI_UART_sample_81BD14B8D71B5662-if00 bumble-auracast bash diff --git a/docker-compose.yaml b/docker-compose.yaml index f78dc73..ec410af 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,14 +3,17 @@ services: build: context: . dockerfile: Dockerfile - #ssh: ["default"] # Enable SSH agent forwarding - ssh: ['default','default=~/.ssh/'] #raspi - volumes: - - /dev:/dev # Mount /dev from host to container + ssh: + - default=~/.ssh/id_ed25519 #lappi + #- default=~/.ssh/id_rsa #raspi + devices: + - /dev/serial/by-id/usb-ZEPHYR_Zephyr_HCI_UART_sample_81BD14B8D71B5662-if00 environment: - - DOCKER_BUILDKIT=1 # Enable BuildKit (can also be passed during build) - # deploy: - # resources: - # reservations: - # devices: - # - capabilities: [all] # Ensures the container can use /dev as needed \ No newline at end of file + LOG_LEVEL: INFO + + # - DOCKER_BUILDKIT=1 # Enable BuildKit (can also be passed during build) + #command: python ./auracast/multicast_server.py #devserver + command: python ./auracast/multicast.py # continously streaming test app + + +# use docker compose up --build \ No newline at end of file diff --git a/src/auracast/multicast.py b/src/auracast/multicast.py index 940c6e9..554680d 100644 --- a/src/auracast/multicast.py +++ b/src/auracast/multicast.py @@ -491,8 +491,13 @@ async def broadcast(global_conf: auracast_config.AuracastGlobalConfig, big_conf: if __name__ == "__main__": import os + if os.environ['LOG_LEVEL']: + log_level = getattr(logging, os.environ['LOG_LEVEL']) + else: + log_level = logging.DEBUG + log_level = os.environ['LOG_LEVEL'] logging.basicConfig( - level=logging.DEBUG, + level=log_level, format='%(module)s.py:%(lineno)d %(levelname)s: %(message)s' ) os.chdir(os.path.dirname(__file__))