diff --git a/.travis.yml b/.travis.yml index e4dc9a0..2312f03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ services: - docker language: bash env: -- RFID_MUSICPLAYER=0.3.1 +- RFID_MUSICPLAYER=0.4.0 script: # prepare for cross compiling - ./prepare_local_build_env.sh @@ -11,6 +11,8 @@ script: - docker build --build-arg RFID_MUSICPLAYER=$RFID_MUSICPLAYER -f Dockerfile.rfid_reader -t protenhan/rpi-rfid-musicplayer_reader . ## build the main player - docker build --build-arg RFID_MUSICPLAYER=$RFID_MUSICPLAYER -f Dockerfile.player -t protenhan/rpi-rfid-musicplayer_player . +## build the button controler +- docker build --build-arg RFID_MUSICPLAYER=$RFID_MUSICPLAYER -f Dockerfile.button_control -t protenhan/rpi-rfid-musicplayer_control . ## push the player image - > if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" @@ -24,4 +26,11 @@ script: docker tag $DOCKER_USER/rpi-rfid-musicplayer_reader $DOCKER_USER/rpi-rfid-musicplayer_reader:$RFID_MUSICPLAYER-alpine docker push $DOCKER_USER/rpi-rfid-musicplayer_reader:$RFID_MUSICPLAYER-alpine docker push $DOCKER_USER/rpi-rfid-musicplayer_reader + fi +## push control image +- > + if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" + docker tag $DOCKER_USER/rpi-rfid-musicplayer_control $DOCKER_USER/rpi-rfid-musicplayer_control:$RFID_MUSICPLAYER-alpine + docker push $DOCKER_USER/rpi-rfid-musicplayer_control:$RFID_MUSICPLAYER-alpine + docker push $DOCKER_USER/rpi-rfid-musicplayer_control fi \ No newline at end of file diff --git a/Dockerfile.button_control b/Dockerfile.button_control new file mode 100644 index 0000000..92b106d --- /dev/null +++ b/Dockerfile.button_control @@ -0,0 +1,17 @@ +FROM arm32v6/alpine:3.8 +LABEL maintainer="@protenhan" + +COPY qemu-arm-static /usr/bin/ +RUN apk update &&\ + apk -U add \ + python3 \ + linux-headers \ + python3-dev \ + gcc \ + musl-dev + +# Setup for the project +COPY src/button_control/python /button_control/ +RUN pip3 install -r /button_control/requirements.txt + +CMD ["python3","-u","/button_control/button_control.py"] diff --git a/Dockerfile.rfid_reader b/Dockerfile.rfid_reader index b37241c..d4f94a2 100644 --- a/Dockerfile.rfid_reader +++ b/Dockerfile.rfid_reader @@ -11,7 +11,7 @@ RUN apk update &&\ musl-dev # Setup for the project -COPY src/python/rfid_reader /rfid-musicplayer/ +COPY src/rfid_reader/python /rfid-musicplayer/ RUN pip3 install -r /rfid-musicplayer/requirements.txt CMD ["python3","-u","/rfid-musicplayer/rfid_reader.py"] diff --git a/docker-compose-local.yml b/docker-compose-local.yml index 887ef3f..62d83a1 100644 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -20,4 +20,13 @@ services: - "/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd:/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd" environment: - RFID_DEVICE_PATH=/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd + - PLAYER_HOST=player:8000 + + button_control: + build: + context: ./ + dockerfile: Dockerfile.button_control + devices: + - "/dev/gpiomem:/dev/gpiomem" + environment: - PLAYER_HOST=player:8000 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ea3f9d0..7daf00e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,4 +16,11 @@ services: - "/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd:/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd" environment: - RFID_DEVICE_PATH=/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd + - PLAYER_HOST=player:8000 + + button_control: + image: protenhan/rpi-rfid-musicplayer_control:latest + devices: + - "/dev/gpiomem:/dev/gpiomem" + environment: - PLAYER_HOST=player:8000 \ No newline at end of file diff --git a/src/python/button_control/button_control.py b/src/button_control/python/button_control.py similarity index 100% rename from src/python/button_control/button_control.py rename to src/button_control/python/button_control.py diff --git a/src/python/button_control/requirements.txt b/src/button_control/python/requirements.txt similarity index 100% rename from src/python/button_control/requirements.txt rename to src/button_control/python/requirements.txt diff --git a/src/python/button_control/__init__.py b/src/python/button_control/__init__.py deleted file mode 100644 index 842f8e0..0000000 --- a/src/python/button_control/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 - -import button_control.button_control.ButtonController - -__all__ = ['ButtonController'] \ No newline at end of file diff --git a/src/python/rfid_reader/requirements.txt b/src/rfid_reader/python/requirements.txt similarity index 93% rename from src/python/rfid_reader/requirements.txt rename to src/rfid_reader/python/requirements.txt index 8ccf180..7c6001e 100644 --- a/src/python/rfid_reader/requirements.txt +++ b/src/rfid_reader/python/requirements.txt @@ -1,4 +1,2 @@ evdev>=0.7.0 requests>=2.20.1 - - diff --git a/src/python/rfid_reader/rfid_reader.py b/src/rfid_reader/python/rfid_reader.py similarity index 100% rename from src/python/rfid_reader/rfid_reader.py rename to src/rfid_reader/python/rfid_reader.py