-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.docker
39 lines (31 loc) · 1.14 KB
/
Makefile.docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.PHONY: clean build
RELEASE_IMAGE_NAME = hazard/rpi-433rc
CURRENT_TAG = 1.1.1
FULL_RELEASE_IMAGE = $(RELEASE_IMAGE_NAME):$(CURRENT_TAG)
FULL_RELEASE_IMAGE_LATEST = $(RELEASE_IMAGE_NAME):latest
CONTAINER_NAME = rpi-433rc
build:
docker build -t $(FULL_RELEASE_IMAGE) .
shell: build
docker run -it --rm \
--name $(CONTAINER_NAME) \
--privileged --cap-add SYS_RAWIO --device=/dev/mem \
$(FULL_RELEASE_IMAGE) bash
run: build
docker run --rm \
--name $(CONTAINER_NAME) \
-p "5555:5000" \
--privileged --cap-add SYS_RAWIO --device=/dev/mem \
$(FULL_RELEASE_IMAGE) serve
sniff: build
docker run --rm -it \
--name $(CONTAINER_NAME) \
--privileged --cap-add SYS_RAWIO --device=/dev/mem \
$(FULL_RELEASE_IMAGE) sniff
push: build
docker push $(FULL_RELEASE_IMAGE)
docker tag $(FULL_RELEASE_IMAGE) $(FULL_RELEASE_IMAGE_LATEST)
docker push $(FULL_RELEASE_IMAGE_LATEST)
clean:
docker ps -a | grep '$(CONTAINER_NAME)' | awk '{print $$1}' | xargs docker rm
if [ $(shell docker image inspect $(FULL_RELEASE_IMAGE) > /dev/null 2>/dev/null ; echo $$?) -eq 0 ] ; then docker rmi $(RELEASE_IMAGE_NAME):$(CURRENT_TAG) ; fi