summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-07-24 20:14:03 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2021-07-24 20:30:55 +0200
commitf41add0bfd185670a093e73770b03a13db9180da (patch)
tree5c79eee417d080f159d44b5647d0ba568f0b4141
parentccfd1a1a039da736d2b9f598f0b020d7e56a9609 (diff)
Restructure many files
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r--Dockerfile34
-rw-r--r--Makefile63
-rw-r--r--etc/debian/build-deps.control12
-rw-r--r--etc/debian/run-deps.control11
-rw-r--r--etc/swarm/manifests/compose.yaml96
-rw-r--r--libexec/deps.mk39
-rw-r--r--libexec/img.mk117
-rw-r--r--libexec/stack.mk143
8 files changed, 418 insertions, 97 deletions
diff --git a/Dockerfile b/Dockerfile
index 00be9c3..6235d65 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,37 +6,33 @@
########################################################################
-ARG BUILD_REG="docker.io"
-ARG BUILD_USER="alejandrocolomar"
-ARG BUILD_REPO="build-essential"
-ARG BUILD_REPOSITORY="${BUILD_REG}/${BUILD_USER}/${BUILD_REPO}"
-ARG BUILD_LBL="1.0.0"
-ARG BUILD_DIGEST="sha256:ccde260ba2881dd35e26a343fafab20e9b5e3e668a0e11d7063675f429937452"
-########################################################################
-ARG NGINX_REG="docker.io"
-ARG NGINX_USER="alejandrocolomar"
-ARG NGINX_REPO="nginx"
-ARG NGINX_REPOSITORY="${NGINX_REG}/${NGINX_USER}/${NGINX_REPO}"
-ARG NGINX_LBL="1.19.9-alpine-alx1"
-ARG NGINX_DIGEST="sha256:7b8d8978173a3d90dbc52048bd5b6a91765c408b8c29b299fcc01f53335ae95a"
+ARG BUILD_REG="docker.io"
+ARG BUILD_USER="alejandrocolomar"
+ARG BUILD_REPO="build-essential"
+ARG BUILD_REPOSITORY="${BUILD_REG}/${BUILD_USER}/${BUILD_REPO}"
+ARG BUILD_LBL="1.0.0"
+ARG BUILD_DIGEST="sha256:ccde260ba2881dd35e26a343fafab20e9b5e3e668a0e11d7063675f429937452"
+########################################################################
+ARG NGINX_REG="docker.io"
+ARG NGINX_USER="alejandrocolomar"
+ARG NGINX_REPO="nginx"
+ARG NGINX_REPOSITORY="${NGINX_REG}/${NGINX_USER}/${NGINX_REPO}"
+ARG NGINX_LBL="1.19.9-alpine-alx1"
+ARG NGINX_DIGEST="sha256:7b8d8978173a3d90dbc52048bd5b6a91765c408b8c29b299fcc01f53335ae95a"
########################################################################
########################################################################
FROM "${BUILD_REPOSITORY}:${BUILD_LBL}@${BUILD_DIGEST}" AS build
-########################################################################
+
COPY ./ /usr/local/src/www/
-########################################################################
WORKDIR /usr/local/src/www/
-########################################################################
-RUN apt-get install -V --no-install-recommends man2html --yes;
-RUN make;
RUN make install-srv;
########################################################################
########################################################################
FROM "${NGINX_REPOSITORY}:${NGINX_LBL}@${NGINX_DIGEST}" AS nginx
-########################################################################
+
COPY --from=build /srv/ /srv/
########################################################################
diff --git a/Makefile b/Makefile
index 55246dd..cc3612a 100644
--- a/Makefile
+++ b/Makefile
@@ -16,49 +16,65 @@ srvdir = /srv
wwwdir = $(srvdir)/www
htmlext = .html
+version = $(shell git describe --tags | sed 's/^v//')
+
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
-current_arch = $(shell uname -m)
+arch_cur = $(shell uname -m)
arch = $(shell uname -m)
+config = $(CURDIR)/.config
-build = $(CURDIR)/etc/docker/images/build-essential
+build = $(CURDIR)/etc/docker/image.d/build-essential
build_reg = $(shell <$(build) grep '^reg' | cut -f2)
build_user = $(shell <$(build) grep '^user' | cut -f2)
build_repo = $(shell <$(build) grep '^repo' | cut -f2)
build_lbl = $(shell <$(build) grep '^lbl' | cut -f2)
-build_digest = $(shell <$(build) grep '^digest' | grep $(current_arch) | cut -f3)
+build_digest = $(shell <$(build) grep '^digest' | grep $(arch_cur) | cut -f3)
-nginx = $(CURDIR)/etc/docker/images/nginx
+nginx = $(CURDIR)/etc/docker/image.d/nginx
nginx_reg = $(shell <$(nginx) grep '^reg' | cut -f2)
nginx_user = $(shell <$(nginx) grep '^user' | cut -f2)
nginx_repo = $(shell <$(nginx) grep '^repo' | cut -f2)
nginx_lbl = $(shell <$(nginx) grep '^lbl' | cut -f2)
nginx_digest = $(shell <$(nginx) grep '^digest' | grep $(arch) | cut -f3)
-www = $(CURDIR)/etc/docker/images/www
-reg = $(shell <$(www) grep '^reg' | cut -f2)
-user = $(shell <$(www) grep '^user' | cut -f2)
-repo = $(shell <$(www) grep '^repo' | cut -f2)
+image = $(CURDIR)/etc/docker/image
+reg = $(shell <$(image) grep '^reg' | cut -f2)
+user = $(shell <$(image) grep '^user' | cut -f2)
+repo = $(shell <$(image) grep '^repo' | cut -f2)
repository = $(reg)/$(user)/$(repo)
-lbl = $(shell <$(www) grep '^lbl' | cut -f2)
-lbl_ = $(shell git describe --tags | sed 's/^v//')
+lbl = $(shell <$(image) grep '^lbl' | cut -f2)
+lbl_ = $(version)
lbl_a = $(lbl_)_$(arch)
img = $(repository):$(lbl)
img_a = $(repository):$(lbl_a)
-archs = $(shell <$(CURDIR)/.config grep '^archs' | cut -f2 | tr ',' ' ')
+archs = $(shell <$(config) grep '^archs' | cut -f2 | tr ',' ' ')
imgs = $(addprefix $(img)_,$(archs))
-digest = $(shell <$(www) grep '^digest' | grep $(arch) | cut -f3)
-digest_ = $(shell echo '$(digest)' | sed 's/sha256:/@sha256:/')
+digest = $(shell <$(image) grep '^digest' | grep $(arch) | cut -f3)
+digest_ = $(addprefix @,$(digest))
-orchestrator = $(shell cat $(CURDIR)/etc/docker/orchestrator)
+orchestrator = $(shell <$(config) grep '^orchest' | cut -f2)
stack = $(shell <$(CURDIR)/.config grep '^stack' | cut -f2)
project = $(shell <$(CURDIR)/.config grep '^project' | cut -f2)
.PHONY: all
all: man
+########################################################################
+# ./libexec deps.mk
+
+.PHONY: deps-build
+deps-build:
+ $(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@
+
+.PHONY: deps-run
+deps-run:
+ $(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@
+
+########################################################################
+
.PHONY: config
config: submodules
@@ -68,26 +84,11 @@ submodules:
.PHONY: Dockerfile
Dockerfile:
- @echo ' Update Dockerfile ARGs';
- @sed -i \
- -e '/^ARG BUILD_REG=/s/=.*/="$(build_reg)"/' \
- -e '/^ARG BUILD_USER=/s/=.*/="$(build_user)"/' \
- -e '/^ARG BUILD_REPO=/s/=.*/="$(build_repo)"/' \
- -e '/^ARG BUILD_LBL=/s/=.*/="$(build_lbl)"/' \
- -e '/^ARG BUILD_DIGEST=/s/=.*/="$(build_digest)"/' \
- -e '/^ARG NGINX_REG=/s/=.*/="$(nginx_reg)"/' \
- -e '/^ARG NGINX_USER=/s/=.*/="$(nginx_user)"/' \
- -e '/^ARG NGINX_REPO=/s/=.*/="$(nginx_repo)"/' \
- -e '/^ARG NGINX_LBL=/s/=.*/="$(nginx_lbl)"/' \
- -e '/^ARG NGINX_DIGEST=/s/=.*/="$(nginx_digest)"/' \
- $(CURDIR)/$@;
+ $(MAKE) -C $(CURDIR)/libexec/ -f img.mk $@
.PHONY: digest
digest:
- @echo ' Update digest';
- @sed -i '\#$(repository)#s#$(lbl).*"$$#$(lbl)$(digest_)"#' \
- $(CURDIR)/etc/kubernetes/manifests/030_deploy.yaml \
- $(CURDIR)/etc/swarm/manifests/compose.yaml;
+ $(MAKE) -C $(CURDIR)/libexec/ -f img.mk $@
.PHONY: html
html: | builddirs-html
diff --git a/etc/debian/build-deps.control b/etc/debian/build-deps.control
new file mode 100644
index 0000000..d7f7160
--- /dev/null
+++ b/etc/debian/build-deps.control
@@ -0,0 +1,12 @@
+Standards-Version: 4.5.0
+
+Package: alx-www-build-deps
+Depends:
+ bash,
+ docker.io | docker-ce,
+ git,
+ grep,
+ make,
+ man,
+ sed,
+ sudo
diff --git a/etc/debian/run-deps.control b/etc/debian/run-deps.control
new file mode 100644
index 0000000..346013e
--- /dev/null
+++ b/etc/debian/run-deps.control
@@ -0,0 +1,11 @@
+Standards-Version: 4.5.0
+
+Package: alx-www-run-deps
+Depends:
+ bash,
+ coreutils,
+ docker.io | docker-ce,
+ grep,
+ make,
+ sed,
+ sudo
diff --git a/etc/swarm/manifests/compose.yaml b/etc/swarm/manifests/compose.yaml
index 38b6b37..ba94a19 100644
--- a/etc/swarm/manifests/compose.yaml
+++ b/etc/swarm/manifests/compose.yaml
@@ -1,55 +1,57 @@
-################################################################################
-## Copyright (C) 2020 Sebastian Francisco Colomar Bauza ##
-## Copyright (C) 2020 Alejandro Colomar Andrés ##
-## SPDX-License-Identifier: GPL-2.0-only ##
-################################################################################
+########################################################################
+# Copyright (C) 2020 Sebastian Francisco Colomar Bauza
+# Copyright (C) 2020, 2021 Alejandro Colomar Andres
+# SPDX-License-Identifier: GPL-2.0-only
+########################################################################
configs:
- etc-nginx-conf-d-security-parameters-conf-www-config:
- file: /run/configs/www/etc/nginx/conf.d/security-parameters.conf
- etc-nginx-conf-d-server-www-config:
- file: /run/configs/www/etc/nginx/conf.d/server.conf
+ etc-nginx-conf-d-security-parameters-conf-www-config:
+ file: /run/configs/www/etc/nginx/conf.d/security-parameters.conf
+ etc-nginx-conf-d-server-www-config:
+ file: /run/configs/www/etc/nginx/conf.d/server.conf
networks:
- alejandro-colomar:
+ alejandro-colomar:
services:
- www:
- configs:
- -
- mode: 0440
- source: etc-nginx-conf-d-security-parameters-conf-www-config
- target: /etc/nginx/conf.d/security-parameters.conf
- -
- mode: 0440
- source: etc-nginx-conf-d-server-www-config
- target: /etc/nginx/conf.d/server.conf
- deploy:
- mode: replicated
- placement:
- constraints:
- - node.role == worker
- replicas: 1
- resources:
- limits:
- cpus: "0.5"
- memory: "1g"
- reservations:
- cpus: "0.5"
- memory: "1g"
- restart_policy:
- condition: any
- healthcheck:
- interval: 10s
- retries: 3
- start_period: 30s
- test: curl -4s -o /dev/null -w '%{http_code}' http://localhost:8080
- timeout: 1s
- image: "docker.io/alejandrocolomar/www:0.48-rc5"
- networks:
- -
- "alejandro-colomar"
- ports:
- - "31001:8080"
+ www:
+ configs:
+ -
+ mode: 0440
+ source: etc-nginx-conf-d-security-parameters-conf-www-config
+ target: /etc/nginx/conf.d/security-parameters.conf
+ -
+ mode: 0440
+ source: etc-nginx-conf-d-server-www-config
+ target: /etc/nginx/conf.d/server.conf
+ deploy:
+ mode: replicated
+ placement:
+ constraints:
+ -
+ node.role == ${node_role}
+ replicas: 1
+ resources:
+ limits:
+ cpus: "0.5"
+ memory: "1g"
+ reservations:
+ cpus: "0.5"
+ memory: "1g"
+ restart_policy:
+ condition: any
+ healthcheck:
+ interval: 10s
+ retries: 3
+ start_period: 30s
+ test: curl -4s -o /dev/null -w '%{http_code}' http://localhost:8080
+ timeout: 1s
+ image: "${image}:${label}${digest}"
+ networks:
+ -
+ "alejandro-colomar"
+ ports:
+ -
+ "${host_port}:8080"
version: "3.8"
diff --git a/libexec/deps.mk b/libexec/deps.mk
new file mode 100644
index 0000000..77ecc59
--- /dev/null
+++ b/libexec/deps.mk
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+########################################################################
+# Copyright (C) 2021 Alejandro Colomar <alx.manpages@gmail.com>
+# SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.0-only
+########################################################################
+SHELL = /bin/bash -Eeuo pipefail
+
+.PHONY: all
+all:
+ $(MAKE) -f deps.mk deps-build;
+ $(MAKE) -f deps.mk deps-run;
+
+.PHONY: deps-build
+deps-build: basic-deps
+ cd $$(mktemp -d) && \
+ chmod 755 . && \
+ equivs-build $(ROOTDIR)/etc/debian/build-deps.control 2>/dev/null \
+ | grep '^dpkg-deb' \
+ | grep -o '\./.*\.deb' \
+ | xargs sudo apt-get install --no-install-recommends -y -q=2;
+
+.PHONY: deps-run
+deps-run: submodules basic-deps
+ cd $$(mktemp -d) && \
+ chmod 755 . && \
+ equivs-build $(ROOTDIR)/etc/debian/run-deps.control 2>/dev/null \
+ | grep '^dpkg-deb' \
+ | grep -o '\./.*\.deb' \
+ | xargs sudo apt-get install --no-install-recommends -y -q=2;
+
+.PHONY: submodules
+submodules:
+ sudo -Eu '$(SUDO_USER)' git submodule init;
+ sudo -Eu '$(SUDO_USER)' git submodule update;
+ $(MAKE) -C $(ROOTDIR)/src/alx/containers/;
+
+.PHONY: basic-deps
+basic-deps:
+ apt-get install --no-install-recommends -y equivs;
diff --git a/libexec/img.mk b/libexec/img.mk
new file mode 100644
index 0000000..3805681
--- /dev/null
+++ b/libexec/img.mk
@@ -0,0 +1,117 @@
+#!/usr/bin/make -f
+########################################################################
+# Copyright (C) 2021 Alejandro Colomar <alx.manpages@gmail.com>
+# SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.0-only
+########################################################################
+SHELL = /bin/bash -Eeuo pipefail
+
+version = $(shell git describe --tags | sed 's/^v//')
+
+arch_cur = $(shell uname -m)
+arch = $(shell uname -m)
+config = $(ROOTDIR)/.config
+
+build = $(ROOTDIR)/etc/docker/image.d/build-essential
+build_reg = $(shell <$(build) grep '^reg' | cut -f2)
+build_user = $(shell <$(build) grep '^user' | cut -f2)
+build_repo = $(shell <$(build) grep '^repo' | cut -f2)
+build_lbl = $(shell <$(build) grep '^lbl' | cut -f2)
+build_digest = $(shell <$(build) grep '^digest' | grep $(arch_cur) | cut -f3)
+
+nginx = $(ROOTDIR)/etc/docker/image.d/nginx
+nginx_reg = $(shell <$(nginx) grep '^reg' | cut -f2)
+nginx_user = $(shell <$(nginx) grep '^user' | cut -f2)
+nginx_repo = $(shell <$(nginx) grep '^repo' | cut -f2)
+nginx_lbl = $(shell <$(nginx) grep '^lbl' | cut -f2)
+nginx_digest = $(shell <$(nginx) grep '^digest' | grep $(arch) | cut -f3)
+
+image = $(ROOTDIR)/etc/docker/image
+reg = $(shell <$(image) grep '^reg' | cut -f2)
+user = $(shell <$(image) grep '^user' | cut -f2)
+repo = $(shell <$(image) grep '^repo' | cut -f2)
+repository = $(reg)/$(user)/$(repo)
+lbl = $(shell <$(image) grep '^lbl' | cut -f2)
+lbl_ = $(version)
+lbl_a = $(lbl_)_$(arch)
+img = $(repository):$(lbl)
+img_a = $(repository):$(lbl_a)
+archs = $(shell <$(config) grep '^archs' | cut -f2 | tr ',' ' ')
+imgs = $(addprefix $(img)_,$(archs))
+digest = $(shell <$(image) grep '^digest' | grep $(arch) | cut -f3)
+digest_ = $(addprefix @,$(digest))
+
+orchestrator = $(shell <$(config) grep '^orchest' | cut -f2)
+stack = $(shell <$(ROOTDIR)/.config grep '^stack' | cut -f2)
+project = $(shell <$(ROOTDIR)/.config grep '^project' | cut -f2)
+
+.PHONY: all
+all: image_
+
+.PHONY: Dockerfile
+Dockerfile:
+ @echo ' Update Dockerfile ARGs';
+ sed -i \
+ -e '/^ARG BUILD_REG=/s/=.*/="$(build_reg)"/' \
+ -e '/^ARG BUILD_USER=/s/=.*/="$(build_user)"/' \
+ -e '/^ARG BUILD_REPO=/s/=.*/="$(build_repo)"/' \
+ -e '/^ARG BUILD_LBL=/s/=.*/="$(build_lbl)"/' \
+ -e '/^ARG BUILD_DIGEST=/s/=.*/="$(build_digest)"/' \
+ -e '/^ARG NGINX_REG=/s/=.*/="$(nginx_reg)"/' \
+ -e '/^ARG NGINX_USER=/s/=.*/="$(nginx_user)"/' \
+ -e '/^ARG NGINX_REPO=/s/=.*/="$(nginx_repo)"/' \
+ -e '/^ARG NGINX_LBL=/s/=.*/="$(nginx_lbl)"/' \
+ -e '/^ARG NGINX_DIGEST=/s/=.*/="$(nginx_digest)"/' \
+ $(ROOTDIR)/$@;
+
+.PHONY: image_
+image_:
+ git fetch;
+ git checkout -f 'version-$(version_)';
+ git clean -fx;
+ $(MAKE) -f img.mk image version=$(version_);
+ git add $(image_);
+ git commit -m 'Build $(img_)';
+ git push;
+
+.PHONY: image
+image:
+ for arch in $(archs); do \
+ $(MAKE) -f img.mk image-build arch=$${arch}; \
+ $(MAKE) -f img.mk image-push arch=$${arch}; \
+ done;
+ $(MAKE) -f img.mk image-manifest;
+
+.PHONY: image-build
+image-build: Dockerfile
+ @echo ' DOCKER image build $(img_a)';
+ docker image build -t '$(img_a)' $(ROOTDIR);
+ sed -i 's/^lbl.*/lbl $(lbl_a)/' $(image_);
+ sed -Ei 's/^(digest $(arch)).*/\1/' $(image);
+
+.PHONY: image-push
+image-push:
+ @echo ' DOCKER image push $(img_a)';
+ docker image push '$(img_a)' \
+ | grep 'digest:' \
+ | sed -E 's/.*digest: ([^ ]+) .*/\1/' \
+ | while read d; do \
+ sed -Ei "s/(digest $(arch)).*/\1 $${d}/" $(image_); \
+ sed -i '\#$(repository)#s#$(lbl).*"$$#$(lbl)$(digest_)"#' \
+ $(ROOTDIR)/etc/kubernetes/manifests/030_deploy.yaml;
+ done;
+
+.PHONY: image-manifest
+image-manifest:
+ $(MAKE) -f img.mk image-manifest-create;
+ $(MAKE) -f img.mk image-manifest-push;
+
+.PHONY: image-manifest-create
+image-manifest-create:
+ @echo ' DOCKER manifest create $(img)';
+ docker manifest create '$(img)' $(imgs) >/dev/null;
+ sed -i 's/^lbl.*/lbl $(lbl)/' $(image_);
+
+.PHONY: image-manifest-push
+image-manifest-push:
+ @echo ' DOCKER manifest push $(img)';
+ docker manifest push '$(img)' >/dev/null;
diff --git a/libexec/stack.mk b/libexec/stack.mk
new file mode 100644
index 0000000..c9a4213
--- /dev/null
+++ b/libexec/stack.mk
@@ -0,0 +1,143 @@
+#!/usr/bin/make -f
+########################################################################
+# Copyright (C) 2021 Alejandro Colomar <alx.manpages@gmail.com>
+# SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.0-only
+########################################################################
+
+# Do not print "Entering directory ..."
+MAKEFLAGS += --no-print-directory
+
+DESTDIR =
+prefix = /usr/local
+sysconfdir = $(prefix:/usr=)/etc
+MANDIR_ = $(CURDIR)/src/man-pages/
+htmlbuilddir = $(CURDIR)/tmp/html
+srvdir = /srv
+wwwdir = $(srvdir)/www
+htmlext = .html
+
+version = $(shell git describe --tags | sed 's/^v//')
+
+INSTALL = install
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_DIR = $(INSTALL) -m 755 -d
+
+arch_cur = $(shell uname -m)
+arch = $(shell uname -m)
+config = $(CURDIR)/.config
+
+build = $(CURDIR)/etc/docker/image.d/build-essential
+build_reg = $(shell <$(build) grep '^reg' | cut -f2)
+build_user = $(shell <$(build) grep '^user' | cut -f2)
+build_repo = $(shell <$(build) grep '^repo' | cut -f2)
+build_lbl = $(shell <$(build) grep '^lbl' | cut -f2)
+build_digest = $(shell <$(build) grep '^digest' | grep $(arch_cur) | cut -f3)
+
+nginx = $(CURDIR)/etc/docker/image.d/nginx
+nginx_reg = $(shell <$(nginx) grep '^reg' | cut -f2)
+nginx_user = $(shell <$(nginx) grep '^user' | cut -f2)
+nginx_repo = $(shell <$(nginx) grep '^repo' | cut -f2)
+nginx_lbl = $(shell <$(nginx) grep '^lbl' | cut -f2)
+nginx_digest = $(shell <$(nginx) grep '^digest' | grep $(arch) | cut -f3)
+
+image = $(CURDIR)/etc/docker/image
+reg = $(shell <$(image) grep '^reg' | cut -f2)
+user = $(shell <$(image) grep '^user' | cut -f2)
+repo = $(shell <$(image) grep '^repo' | cut -f2)
+repository = $(reg)/$(user)/$(repo)
+lbl = $(shell <$(image) grep '^lbl' | cut -f2)
+lbl_ = $(version)
+lbl_a = $(lbl_)_$(arch)
+img = $(repository):$(lbl)
+img_a = $(repository):$(lbl_a)
+archs = $(shell <$(config) grep '^archs' | cut -f2 | tr ',' ' ')
+imgs = $(addprefix $(img)_,$(archs))
+digest = $(shell <$(image) grep '^digest' | grep $(arch) | cut -f3)
+digest_ = $(addprefix @,$(digest))
+
+orchestrator = $(shell <$(config) grep '^orchest' | cut -f2)
+stack = $(shell <$(CURDIR)/.config grep '^stack' | cut -f2)
+project = $(shell <$(CURDIR)/.config grep '^project' | cut -f2)
+
+.PHONY: all
+all: man
+
+########################################################################
+# ./libexec deps.mk
+
+.PHONY: deps-build
+deps-build:
+ $(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@;
+
+.PHONY: deps-run
+deps-run:
+ $(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@;
+
+########################################################################
+
+.PHONY: config
+config: submodules
+
+.PHONY: submodules
+submodules:
+ git submodule init && git submodule update;
+
+.PHONY: Dockerfile
+Dockerfile:
+ @echo ' Update Dockerfile ARGs';
+ sed -i \
+ -e '/^ARG BUILD_REG=/s/=.*/="$(build_reg)"/' \
+ -e '/^ARG BUILD_USER=/s/=.*/="$(build_user)"/' \
+ -e '/^ARG BUILD_REPO=/s/=.*/="$(build_repo)"/' \
+ -e '/^ARG BUILD_LBL=/s/=.*/="$(build_lbl)"/' \
+ -e '/^ARG BUILD_DIGEST=/s/=.*/="$(build_digest)"/' \
+ -e '/^ARG NGINX_REG=/s/=.*/="$(nginx_reg)"/' \
+ -e '/^ARG NGINX_USER=/s/=.*/="$(nginx_user)"/' \
+ -e '/^ARG NGINX_REPO=/s/=.*/="$(nginx_repo)"/' \
+ -e '/^ARG NGINX_LBL=/s/=.*/="$(nginx_lbl)"/' \
+ -e '/^ARG NGINX_DIGEST=/s/=.*/="$(nginx_digest)"/' \
+ $(CURDIR)/$@;
+
+.PHONY: digest
+digest:
+ @echo ' Update digest';
+ sed -i '\#$(repository)#s#$(lbl).*"$$#$(lbl)$(digest_)"#' \
+ $(CURDIR)/etc/kubernetes/manifests/030_deploy.yaml \
+ $(CURDIR)/etc/swarm/manifests/compose.yaml;
+
+.PHONY: install
+install: install-srv
+
+.PHONY: install-srv
+install-srv: | installdirs-srv
+ @echo ' INSTALL $(DESTDIR)$(srvdir)/**';
+ cd srv/ && \
+ find ./ -type f \
+ |while read f; do \
+ $(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(srvdir)/$$f" || exit $$?; \
+ done;
+
+.PHONY: installdirs-srv
+installdirs-srv:
+ @cd srv/ && \
+ find ./ -type d \
+ |while read d; do \
+ $(INSTALL_DIR) "$(DESTDIR)$(srvdir)/$$d" || exit $$?; \
+ done;
+
+.PHONY: stack-deploy
+stack-deploy: digest
+ @echo ' STACK deploy $(stack)';
+ export node_role='$(node_role)'; \
+ export image='$(repository)'; \
+ export label='$(lbl_)'; \
+ export digest='$(digest_)'; \
+ export host_port='$(host_port)'; \
+ cd $(ROOTDIR); \
+ @alx_stack_deploy -o '$(orchestrator)' '$(stack)';
+
+.PHONY: stack-rm-stable
+.PHONY: stack-rm-test
+stack-rm-stable stack-rm-test: stack-rm-%:
+ @echo ' STACK rm $(orchestrator) $(project)-$*';
+ alx_stack_delete -o '$(orchestrator)' '$(project)-$*';