forked from openedx-unsupported/configuration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.mk
More file actions
52 lines (41 loc) · 1.88 KB
/
Copy pathdocker.mk
File metadata and controls
52 lines (41 loc) · 1.88 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
.PHONY: docker.build docker.clean docker.push
SHARD=0
SHARDS=1
IMAGE_TAG?=latest
BUILD_TAG?=test
dockerfiles:=$(shell ls docker/build/*/Dockerfile)
#all_images:=$(patsubst docker/build/%/Dockerfile,%,$(dockerfiles))
all_images:=edxapp notes ecommerce credentials discovery forum devpi
# Used in the test.mk file as well.
# set COMMIT_RANGE in CI environment for build on need
images:=$(if $(COMMIT_RANGE),$(shell git diff --name-only $(COMMIT_RANGE) | python util/parsefiles.py),$(all_images))
#images:=edxapp notes ecommerce credentials discovery forum devpi
docker_build=docker.build.
docker_push=docker.push.
docker_clean=docker.clean.
help: docker.help
docker.help:
@echo ' Docker:'
@echo ' $$image: "images in $(images)"'
@echo ' $$container: any container defined in docker/build/$$container/Dockerfile'
@echo ''
@echo ' $(docker_build)$$container build $$container'
@echo ' $(docker_push)$$container push $$container to dockerhub '
@echo ''
@echo ' docker.build build all defined docker containers (based on dockerhub base images)'
@echo ' docker.push push all defined docker containers'
@echo ''
clean: docker.clean
build: docker.build
docker.test.shard: $(foreach image,$(shell echo $(images) | python util/balancecontainers.py $(SHARDS) | awk 'NR%$(SHARDS)==$(SHARD)'),$(docker_test)$(image))
docker.build: $(foreach image,$(images),$(docker_build)$(image))
docker.push: $(foreach image,$(images),$(docker_push)$(image))
docker.clean: $(foreach image,$(images),$(docker_clean)$(image))
$(docker_build)%: docker/build/%/Dockerfile
docker build -t ltdps/$*:$(BUILD_TAG) -f $< .
$(docker_push)%: $(docker_build)%
docker tag ltdps/$*:$(BUILD_TAG) ltdps/$*:$(IMAGE_TAG)
docker push ltdps/$*:$(IMAGE_TAG)
$(docker_clean)%:
docker rmi ltdps/$*:$(BUILD_TAG) || true
docker rmi `docker images -f "dangling=true" -q` || true