-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile.omd-labs-debian
53 lines (47 loc) · 1.53 KB
/
Makefile.omd-labs-debian
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
# This file is used to manage local images
# depending of the current dir and branch.
# Branch 'master' leads to no tag (=latest),
# others to "local/[dirname]:[branchname]
DISTRO=debian
# local builds will be named like this
REPO = local/omd-labs-$(DISTRO)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
# BRANCH=TAG, but "master"="nightly"
TAG = $(shell git rev-parse --abbrev-ref HEAD | sed 's/master/nightly/')
# the final image name
IMAGE=$(REPO):$(TAG)
# will create another OMD site SITENAME, if set
ifdef SITENAME
BUILDARGS = --build-arg SITENAME=$(SITENAME)
else
SITENAME=demo
endif
export DOCKER_REPO=index.docker.io/consol/omd-labs-$(DISTRO)
export IMAGE_NAME=$(IMAGE)
export SOURCE_BRANCH=$(BRANCH)
.PHONY: build bash start echo
build:
# the hook is also executed on Docker Hub
./hooks/build $(BUILDARGS)
@echo "Successfully built" $(IMAGE)
start:
docker run -p 8443:443 -d $(IMAGE)
startvol:
mkdir -p site/local
mkdir -p site/etc
mkdir -p site/var
docker run -d -p 8443:443 \
-v $(shell pwd)/site/local:/omd/sites/$(SITENAME)/local.mount \
-v $(shell pwd)/site/etc:/omd/sites/$(SITENAME)/etc.mount \
-v $(shell pwd)/site/var:/omd/sites/$(SITENAME)/var.mount \
$(IMAGE)
echo:
@echo $(IMAGE)
bash:
docker run --rm -p 8443:443 -it $(IMAGE) /bin/bash
bashvol:
docker run --rm -p 8443:443 -it \
-v $(shell pwd)/site/local:/omd/sites/$(SITENAME)/local.mount \
-v $(shell pwd)/site/etc:/omd/sites/$(SITENAME)/etc.mount \
-v $(shell pwd)/site/var:/omd/sites/$(SITENAME)/var.mount \
$(IMAGE) /bin/bash