1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

docker: improved build system and added new labels to images

This commit is contained in:
Steffen Vogel 2017-11-01 10:05:39 +01:00
parent a738d6403d
commit 4c63ac6aa8
6 changed files with 117 additions and 27 deletions

View file

@ -28,15 +28,6 @@ DEPLOY_USER ?= acs
DEPLOY_HOST ?= villas.fein-aachen.org
DEPLOY_PATH ?= /var/www/villas/node
DOCKER_FILE ?= Dockerfile
DOCKER_IMAGE ?= villas/node
DOCKER_TAG ?= $(GIT_BRANCH)
deploy-docker-dev: DOCKER_IMAGE := $(DOCKER_IMAGE)-dev
docker-dev: DOCKER_IMAGE := $(DOCKER_IMAGE)-dev
docker-dev: DOCKER_FILE := $(DOCKER_FILE).dev
packaging: rpm dist
deploy: deploy-dist deploy-rpm deploy-docker
@ -54,22 +45,12 @@ deploy-rpm:
rsync -a --progress $(RPMDIR)/RPMS/ $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)/../packages/
ssh $(DEPLOY_USER)@$(DEPLOY_HOST) createrepo $(DEPLOY_PATH)/../packages
deploy-docker deploy-docker-dev:
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)
# Docker targets
run-docker-dev:
docker run -it -p 80:80 -p 443:443 -p 1234:1234 -p 12000:12000/udp -p 12001:12001/udp --privileged --security-opt seccomp:unconfined -v "$(SRCDIR):/villas" $(DOCKER_IMAGE)-dev:$(GIT_BRANCH)
docker docker-dev:
docker pull fedora:25
docker build -f $(DOCKER_FILE) -t $(DOCKER_IMAGE):$(DOCKER_TAG) $(SRCDIR)
clean-packaging:
rm -f $(BUILDDIR)/packaging/villas-node-$(VERSION_NUM).tar.gz
install-packaging:
.PHONY: packaging install-packaging clean-packaging deploy deploy-dist deploy-rpm dist docker docker-dev run-docker-dev $(TAR_VILLAS)
.PHONY: packaging install-packaging clean-packaging deploy deploy-dist deploy-rpm dist $(TAR_VILLAS)
include packaging/rpm/Makefile.inc
include packaging/docker/Makefile.inc

View file

@ -24,8 +24,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
FROM fedora:latest
MAINTAINER Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
FROM registry.fedoraproject.org/fedora:27
LABEL \
org.label-schema.schema-version = "1.0" \
org.label-schema.name = "VILLASnode" \
org.label-schema.license = "GPL-3.0" \
org.label-schema.vendor = "Institute for Automation of Complex Power Systems, RWTH Aachen University" \
org.label-schema.author.name = "Steffen Vogel" \
org.label-schema.author.email = "stvogel@eonerc.rwth-aachen.de" \
org.label-schema.description = "A image containing for VILLASnode based on Fedora" \
org.label-schema.url = "http://fein-aachen.org/projects/villas-framework/" \
org.label-schema.vcs-url = "https://git.rwth-aachen.de/VILLASframework/VILLASnode" \
org.label-schema.usage = "https://villas.fein-aachen.org/doc/node-installation.html#node-installation-docker"
# Some of the dependencies are only available in our own repo
ADD https://villas.fein-aachen.org/packages/villas.repo /etc/yum.repos.d/

View file

@ -28,8 +28,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
FROM fedora:25
MAINTAINER Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
FROM registry.fedoraproject.org/fedora:27
LABEL \
org.label-schema.schema-version="1.0" \
org.label-schema.name="VILLASnode" \
org.label-schema.license="GPL-3.0" \
org.label-schema.vendor="Institute for Automation of Complex Power Systems, RWTH Aachen University" \
org.label-schema.author.name="Steffen Vogel" \
org.label-schema.author.email="stvogel@eonerc.rwth-aachen.de" \
org.label-schema.description="A image containing all build-time dependencies for VILLASnode based on Fedora" \
org.label-schema.url="http://fein-aachen.org/projects/villas-framework/" \
org.label-schema.vcs-url="https://git.rwth-aachen.de/VILLASframework/VILLASnode" \
org.label-schema.usage="https://villas.fein-aachen.org/doc/node-installation.html#node-installation-docker"
# Toolchain
RUN dnf -y install \

View file

@ -29,7 +29,18 @@
###################################################################################
FROM centos:7
MAINTAINER Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
LABEL \
org.label-schema.schema-version = "1.0" \
org.label-schema.name = "VILLASnode" \
org.label-schema.license = "GPL-3.0" \
org.label-schema.vendor = "Institute for Automation of Complex Power Systems, RWTH Aachen University" \
org.label-schema.author.name = "Steffen Vogel" \
org.label-schema.author.email = "stvogel@eonerc.rwth-aachen.de" \
org.label-schema.description = "A image containing all build-time dependencies for VILLASnode based on CentOS" \
org.label-schema.url = "http://fein-aachen.org/projects/villas-framework/" \
org.label-schema.vcs-url = "https://git.rwth-aachen.de/VILLASframework/VILLASnode" \
org.label-schema.usage = "https://villas.fein-aachen.org/doc/node-installation.html#node-installation-docker"
# Some of the dependencies are only available in our own repo
ADD https://villas.fein-aachen.org/packages/villas.repo /etc/yum.repos.d/

View file

@ -32,7 +32,17 @@
FROM ubuntu:xenial
#FROM debian:jessie
MAINTAINER Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
LABEL \
org.label-schema.schema-version = "1.0" \
org.label-schema.name = "VILLASnode" \
org.label-schema.license = "GPL-3.0" \
org.label-schema.vendor = "Institute for Automation of Complex Power Systems, RWTH Aachen University" \
org.label-schema.author.name = "Steffen Vogel" \
org.label-schema.author.email = "stvogel@eonerc.rwth-aachen.de" \
org.label-schema.description = "A image containing all build-time dependencies for VILLASnode based on Ubuntu" \
org.label-schema.url = "http://fein-aachen.org/projects/villas-framework/" \
org.label-schema.vcs-url = "https://git.rwth-aachen.de/VILLASframework/VILLASnode" \
org.label-schema.usage = "https://villas.fein-aachen.org/doc/node-installation.html#node-installation-docker"
# Toolchain
RUN apt-get update && apt-get install -y \

View file

@ -0,0 +1,66 @@
# Makefile.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
DOCKER = docker
DOCKER_FILE ?= Dockerfile
DOCKER_IMAGE ?= villas/node
DOCKER_TAG ?= $(GIT_BRANCH)
DOCKER_TARGETS = docker-app docker-dev docker-dev-centos docker-dev-ubuntu
DOCKER_RUN_TARGETS = $(addprefix run-,$(DOCKER_TARGETS))
DOCKER_DEPLOY_TARGETS = $(addprefix deploy-,$(DOCKER_TARGETS))
DOCKER_RUN_OPTS = --interactive --tty \
--port 80:80 --port 443:443 --port 12000:12000/udp --port 12001:12001/udp \
--privileged --security-opt seccomp:unconfined --volume "$(SRCDIR):/villas"
# Special cases for 'docker'target
run-docker: run-docker-app
deploy-docker: deploy-docker-app
docker: docker-app
$(DOCKER) tag $(DOCKER_IMAGE)-app:$(DOCKER_TAG) $(DOCKER_IMAGE):$(DOCKER_TAG)
.PHONY: docker run-docker deploy-docker
$(DOCKER_DEPLOY_TARGETS): deploy-docker-%: docker-%
$(DOCKER) push $(DOCKER_IMAGE)-%*:$(DOCKER_TAG)
$(DOCKER_RUN_TARGETS): run-docker-%: docker-%
$(DOCKER) run $(DOCKER_RUN_OPTS) $(DOCKER_IMAGE)-$*:$(DOCKER_TAG)
$(DOCKER_TARGETS): docker-%: $(BUILDDIR)/packaging/docker/Image.%
# 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.
$(BUILDDIR)/packaging/docker/Image.%: packaging/docker/Dockerfile.% | $(BUILDDIR)/packaging/docker/
$(DOCKER) build --pull \
--file $< --iidfile $@ \
--tag $(DOCKER_IMAGE)-$*:$(DOCKER_TAG) \
--label org.label-schema.vcs-ref="$(GIT_REV)" \
--label org.label-schema.vcs-branch="$(GIT_BRANCH)" \
--label org.label-schema.version="$(VERSION)" \
--label org.label-schema.variant="$(VARIANT)" \
$(SRCDIR)
.PHONY: $(DOCKER_TARGETS) $(DOCKER_RUN_TARGETS) $(DOCKER_DEPLOY_TARGETS)