-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker.mk
More file actions
60 lines (47 loc) · 2.86 KB
/
docker.mk
File metadata and controls
60 lines (47 loc) · 2.86 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This file is for you! Edit it to implement your own Docker make targets.
# ==============================================================================
# Custom implementation - implementation of a make target should not exceed 5 lines of effective code.
# In most cases there should be no need to modify the existing make targets.
DOCKER_IMAGE ?= $(or ${docker_image}, $(or ${IMAGE}, $(or ${image}, ghcr.io/org/repo)))
DOCKER_TITLE ?= $(or "${docker_title}", $(or "${TITLE}", $(or "${title}", "Service Docker image")))
docker-bake-dockerfile: # Create Dockerfile.effective - optional: docker_dir|dir=[path to the image directory where the Dockerfile is located, default is '.'] @Development
make _docker cmd="bake-dockerfile" \
dir=$(or ${docker_dir}, ${dir})
docker-build: # Build Docker image - optional: docker_dir|dir=[path to the Dockerfile to use, default is '.'] @Development
dir=$(or ${docker_dir}, ${dir})
make _docker cmd="build"
docker-build: docker-lint
docker-lint: # Run hadolint over the Dockerfile - optional: docker_dir|dir=[path to the image directory where the Dockerfile is located, default is '.'] @Development
dir=$(or ${docker_dir}, ${dir})
make _docker cmd="lint"
docker-lint: docker-bake-dockerfile
docker-push: # Push Docker image - optional: docker_dir|dir=[path to the image directory where the Dockerfile is located, default is '.'] @Development
make _docker cmd="push" \
dir=$(or ${docker_dir}, ${dir})
docker-run: # Run Docker image - optional: docker_dir|dir=[path to the image directory where the Dockerfile is located, default is '.'] @Development
make _docker cmd="run" \
dir=$(or ${docker_dir}, ${dir})
clean:: # Remove Docker resources (docker) - optional: docker_dir|dir=[path to the image directory where the Dockerfile is located, default is '.'] @Operations
make _docker cmd="clean" \
dir=$(or ${docker_dir}, ${dir})
_docker: # Docker command wrapper - mandatory: cmd=[command to execute]; optional: dir=[path to the image directory where the Dockerfile is located, relative to the project's top-level directory, default is '.']
# 'DOCKER_IMAGE' and 'DOCKER_TITLE' are passed to the functions as environment variables
dir=$(realpath $(or ${dir}, infrastructure/images/${DOCKER_IMAGE}))
source scripts/docker/docker.lib.sh
docker-${cmd} # 'dir' is accessible by the function as environment variable
# ==============================================================================
# Quality checks - please DO NOT edit this section!
docker-shellscript-lint: # Lint all Docker module shell scripts @Quality
for file in $$(find scripts/docker -type f -name "*.sh"); do
file=$${file} scripts/shellscript-linter.sh
done
# ==============================================================================
${VERBOSE}.SILENT: \
_docker \
clean \
docker-bake-dockerfile \
docker-build \
docker-lint \
docker-push \
docker-run \
docker-shellscript-lint \