Adjust dockerfile and docker-build steps
- Now that sourcing setup.sh requires, board/ for the bsp, we need to
pull this into the container. So copy board/build into a temporary
folder, and place the Dockerfile alongside them. The rest of the setup
we run to make the container is unchanged.
- Add some dependencies to docker-build target, so that it properly
regenerates if a new prerequisite or the like is added.
Change-Id: I56afdc5fcef52f4029e1745c815265a0bfc8ed9b
diff --git a/Dockerfile b/Dockerfile
index 68c6e53..cf0c189 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,7 +16,8 @@
MAINTAINER support-aiyprojects@google.com
# Install the prerequisite packages into the image.
-ADD . /build
+ADD ./build /build
+ADD ./board /board
RUN /bin/bash -c '\
apt-get update && \
apt-get install sudo make && \
diff --git a/docker.mk b/docker.mk
index 4a3767e..66fabf1 100644
--- a/docker.mk
+++ b/docker.mk
@@ -26,11 +26,15 @@
mkdir -p $(ROOTDIR)/cache
cp $< $(ROOTDIR)/cache
else
-$(ROOTDIR)/cache/aiy-board-builder.tar:
- mkdir -p $(ROOTDIR)/cache
- docker build -t aiy-board-builder $(ROOTDIR)/build
+$(ROOTDIR)/cache/aiy-board-builder.tar: $(ROOTDIR)/build/Dockerfile $(ROOTDIR)/build/prereqs.mk
+ mkdir -p $(ROOTDIR)/cache/docker-build
+ cp -a $(ROOTDIR)/build $(ROOTDIR)/cache/docker-build
+ cp -a $(ROOTDIR)/board $(ROOTDIR)/cache/docker-build
+ cp -a $(ROOTDIR)/build/Dockerfile $(ROOTDIR)/cache/docker-build
+ docker build -t aiy-board-builder $(ROOTDIR)/cache/docker-build
docker image save -o $@ aiy-board-builder:latest
docker rmi aiy-board-builder:latest
+ rm -rf $(ROOTDIR)/cache/docker-build
endif
# Runs any make TARGET in x86 docker image ('m docker-TARGET')