diff --git a/.dockerignore b/.dockerignore index d77bff3d8..db3044a10 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,2 @@ -* -!build/release/packaging/rpm/* -!thirdparty/criterion/ -!thirdparty/libiec61850/ -thirdparty/*/build/ +build/ +packaging/docker/Dockerfile.* diff --git a/packaging/docker/Dockerfile.app b/packaging/docker/Dockerfile.app index 514db8d7f..950c3a7cb 100644 --- a/packaging/docker/Dockerfile.app +++ b/packaging/docker/Dockerfile.app @@ -24,8 +24,21 @@ # along with this program. If not, see . ################################################################################### -FROM fedora:27 +ARG BUILDER_IMAGE=villas/node-dev +# This image is built by villas-node-git/packaging/docker/Dockerfile.dev +FROM villas/node-dev:develop AS builder + +COPY . /villas-node/ + +RUN rm -rf /villas-node/build +WORKDIR /villas-node + +#RUN dnf -y install + +RUN make -j2 rpm-villas-node + +FROM fedora:28 ARG GIT_REV=unkown ARG GIT_BRANCH=unkown @@ -46,16 +59,12 @@ RUN dnf -y install \ libcurl \ jansson \ iproute \ - kernel-modules-extra \ module-init-tools -# Ugly: we need to invalidate the cache -ADD https://villas.fein-aachen.org/packages/repodata/repomd.xml /tmp +ADD https://villas.fein-aachen.org/packages/villas.repo /etc/yum.repos.d/ -# Install the application -RUN dnf -y --refresh install \ - villas-node \ - villas-node-doc +COPY --from=builder /villas-node/build/Linux-x86_64-release/packaging/rpm/RPMS/x86_64/*.rpm /tmp/ +RUN dnf -y install /tmp/*.rpm # For WebSocket / API access EXPOSE 80 diff --git a/packaging/docker/Makefile.inc b/packaging/docker/Makefile.inc index ff1d3992f..b88b940e8 100644 --- a/packaging/docker/Makefile.inc +++ b/packaging/docker/Makefile.inc @@ -50,6 +50,10 @@ $(DOCKER_RUN_TARGETS): run-docker-%: docker-% $(DOCKER_TARGETS): docker-%: $(BUILDDIR)/packaging/docker/Image.% +ifneq ($(CI_COMMIT_TAG),) + DOCKER_OPTS += --tag $(DOCKER_IMAGE)-$*:$(CI_COMMIT_TAG) +endif + # The docker build targets use the --iidfile option to write the newly build image # id to an file. Make is using the modification timestamp of this file and the Dockerfile # to determine when the image needs to be rebuild.