it can now run in a docker container. YEEEY
This commit is contained in:
parent
837807c066
commit
42248456d8
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FROM python:3.12
|
||||||
|
|
||||||
|
WORKDIR = /src
|
||||||
|
|
||||||
|
COPY python/src/ .
|
||||||
|
COPY python/requierements.txt .
|
||||||
|
COPY python/docker_entrypoint.sh /
|
||||||
|
|
||||||
|
RUN mkdir data
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y bluez sudo
|
||||||
|
|
||||||
|
RUN pip3.12 install -r requierements.txt && rm -f requierements.txt
|
||||||
|
|
||||||
|
ENTRYPOINT sh /docker_entrypoint.sh
|
||||||
11
README.md
11
README.md
@ -41,3 +41,14 @@ Run Gateway
|
|||||||
cd python/src
|
cd python/src
|
||||||
sudo python3 main.py
|
sudo python3 main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
Build docker container
|
||||||
|
```bash
|
||||||
|
docker-compose build
|
||||||
|
```
|
||||||
|
Run docker container. Killing the hosts bluetooth service is needed to access it from the docker container.
|
||||||
|
```bash
|
||||||
|
sudo sh run_docker.sh
|
||||||
|
```
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
version: '3.3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
atc_mithermometer_gateway:
|
atc_mithermometer_gateway:
|
||||||
image: atc-mithermometer-gateway:develop
|
image: atc-mithermometer-gateway:develop
|
||||||
container_name: ATC_MiThermometer_Gateway
|
container_name: ATC_MiThermometer_Gateway
|
||||||
|
build: .
|
||||||
@ -1,2 +0,0 @@
|
|||||||
FROM python:3.12-alpine3.20
|
|
||||||
|
|
||||||
8
python/docker_entrypoint.sh
Normal file
8
python/docker_entrypoint.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
service dbus start
|
||||||
|
bluetoothd &
|
||||||
|
|
||||||
|
/bin/bash
|
||||||
|
|
||||||
|
sudo python3 main.py
|
||||||
9
run_docker.sh
Normal file
9
run_docker.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
sudo killall -9 bluetoothd
|
||||||
|
docker stop atc-mithermometer-gateway:develop
|
||||||
|
docker run \
|
||||||
|
--cap-add=SYS_ADMIN \
|
||||||
|
--cap-add=NET_ADMIN \
|
||||||
|
--net=host \
|
||||||
|
-v /var/run/dbus/:/var/run/dbus/ \
|
||||||
|
-v /path/to/data:/src/data \
|
||||||
|
atc-mithermometer-gateway:develop
|
||||||
Loading…
x
Reference in New Issue
Block a user