forked from astronomer/astronomer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (59 loc) · 2.24 KB
/
Makefile
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
61
62
63
64
65
66
67
68
69
70
71
72
# You can override vars like REPOSITORY in a local.make file
-include local.make
# Public repository for images.
REPOSITORY ?= astronomerinc
# Bump this on subsequent build, reset on new version or public release. Inherit from env for CI builds.
BUILD_NUMBER ?= 1
ASTRONOMER_MAJOR_VERSION ?= 0
ASTRONOMER_MINOR_VERSION ?= 1
ASTRONOMER_PATCH_VERSION ?= 0
ASTRONOMER_VERSION ?= "${ASTRONOMER_MAJOR_VERSION}.${ASTRONOMER_MINOR_VERSION}.${ASTRONOMER_PATCH_VERSION}"
# List of all components and order to build.
PLATFORM_COMPONENTS := base commander phoenix airflow event-api event-router
PLATFORM_ONBUILD_COMPONENTS := airflow
VENDOR_COMPONENTS := nginx registry cadvisor grafana prometheus statsd-exporter
ALL_COMPONENTS := ${PLATFORM_COMPONENTS} ${VENDOR_COMPONENTS}
# Documentation build vars.
DOCS_DOMAIN ?= open.astronomer.io
DOCS_BUCKET ?= gs://${DOCS_DOMAIN}
DOCS_SRC := docs
DOCS_DEST := docs/_site
# Set default for make.
.DEFAULT_GOAL := build
.PHONY: build
build:
PLATFORM_COMPONENTS="${PLATFORM_COMPONENTS}" \
VENDOR_COMPONENTS="${VENDOR_COMPONENTS}" \
REPOSITORY=${REPOSITORY} \
ASTRONOMER_VERSION=${ASTRONOMER_VERSION} \
BUILD_NUMBER=${BUILD_NUMBER} \
bin/build-images
.PHONY: push-images
push-images: build
for component in ${ALL_COMPONENTS} ; do \
echo "Pushing ap-$${component} ========================================"; \
docker push ${REPOSITORY}/ap-$${component}:latest || exit 1; \
docker push ${REPOSITORY}/ap-$${component}:${ASTRONOMER_VERSION} || exit 1; \
done; \
for component in ${PLATFORM_ONBUILD_COMPONENTS} ; do \
docker push ${REPOSITORY}/ap-$${component}:latest-onbuild || exit 1; \
docker push ${REPOSITORY}/ap-$${component}:${ASTRONOMER_VERSION}-onbuild || exit 1; \
done
.PHONY: clean-containers
clean-containers:
for container in `docker ps -aq -f label=io.astronomer.docker.open=true` ; do \
docker rm -f -v $${container} ; \
done
.PHONY: clean-images
clean-images:
for image in `docker images -q -f label=io.astronomer.docker=true` ; do \
docker rmi -f $${image} ; \
done
.PHONY: clean
clean: clean-containers clean-images
.PHONY: build-docs
build-docs:
jekyll build --source ${DOCS_SRC} --destination ${DOCS_DEST}
.PHONY: push-docs
push-docs: build-docs
gsutil -m rsync -a public-read -d -r ${DOCS_DEST} ${DOCS_BUCKET}