Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Prepared base image with entrypoint. Sniffing already works ;-)
Next step is to write a nice flask app to provide remote control
by an rest interface
  • Loading branch information
HazardDede committed Feb 3, 2018
1 parent 92c250b commit 376b084
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM arm32v7/python:3.6-jessie

ENV RPIRF_VERSION 0.9.6

# Setup workdir
ENV WORKDIR /rpi-433rc
RUN mkdir -p ${WORKDIR} && \
cd ${WORKDIR}

COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Install necessary dependencies
RUN pip3 install rpi-rf==${RPIRF_VERSION}

# Install rest-api wrapper for rpi-rf
# Not yet implemented

# Entrypoint defaults to bash
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]

23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.PHONY: clean build

RELEASE_IMAGE_NAME = rpi-433rc
CURRENT_TAG = latest

CONTAINER_NAME = rpi-433rc

build:
docker build -t $(RELEASE_IMAGE_NAME):$(CURRENT_TAG) .

shell: build
docker run -it --rm --name $(CONTAINER_NAME) --privileged --cap-add SYS_RAWIO --device=/dev/mem $(RELEASE_IMAGE_NAME):$(CURRENT_TAG) bash

run: build
docker run --rm --name $(CONTAINER_NAME) --privileged --cap-add SYS_RAWIO --device=/dev/mem $(RELEASE_IMAGE_NAME):$(CURRENT_TAG)

sniff: build
docker run --rm -it --name $(CONTAINER_NAME) --privileged --cap-add SYS_RAWIO --device=/dev/mem $(RELEASE_IMAGE_NAME):$(CURRENT_TAG) sniff

clean:
docker ps -a | grep '$(CONTAINER_NAME)' | awk '{print $$1}' | xargs docker rm
if [ $(shell docker image inspect $(RELEASE_IMAGE_NAME):$(CURRENT_TAG) > /dev/null 2>/dev/null ; echo $$?) -eq 0 ] ; then docker rmi $(RELEASE_IMAGE_NAME):$(CURRENT_TAG) ; fi

16 changes: 16 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

case ${1} in
sniff)
shift
exec rpi-rf_receive "$@"
;;
serve)
echo "Serving via rest-api is not implemented"
break
;;
*)
exec "$@"
;;
esac

0 comments on commit 376b084

Please sign in to comment.