forked from NangoHQ/nango
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (60 loc) · 1.69 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
73
PIZZLY_IMAGE = toucantoco/pizzly
PIZZLY_VERSION = v`cat ./package.json | jq -r .version`
QUAYIO_IMAGE = $(PIZZLY_IMAGE)
QUAYIO_REGISTRY = quay.io
##
## Misc commands
## -----
##
list: ## Generate basic list of all targets
@grep '^[^\.#[:space:]].*:' Makefile | \
grep -v "=" | \
cut -d':' -f1
help: ## Makefile help
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | \
sed -e 's/\[32m##/[33m/'
get-version:
@echo ${PIZZLY_VERSION}
set-version:
@if [ -z "${NEW_VERSION}" ]; then \
echo "Usage: make set-version NEW_VERSION=X.Y.Z" && \
exit 1; \
fi
@NEW_VERSION=`echo ${NEW_VERSION} | sed -e "s/^v//g"` && \
jq -r ".version |= \"$${NEW_VERSION}\"" package.json > package.json.temp && \
mv package.json.temp package.json
##
## Dev management commands
## -----
##
test:
npm test
docker-test: docker-build-testing
docker run \
--name=pizzly \
--entrypoint /usr/bin/make \
--rm $(PIZZLY_IMAGE):testing-${BUILD_RANDOM_ID} \
test
pizzly-docker-run: docker-build
docker run \
-p 3000:3000 \
-it \
--name=pizzly \
--env-file=.env \
--rm $(QUAYIO_REGISTRY)/$(QUAYIO_IMAGE):$(PIZZLY_VERSION)
##
## Docker images commands
## -----
##
docker-build-testing:
docker build \
-f Dockerfile-testing \
-t $(PIZZLY_IMAGE):testing-${BUILD_RANDOM_ID} .
docker-build-prod:
docker build --no-cache -t $(PIZZLY_IMAGE):$(PIZZLY_VERSION) .
push-to-registry:
for tag in ${PIZZLY_VERSION} ${PIZZLY_IMAGE_MORE_TAGS}; do \
docker tag ${PIZZLY_IMAGE}:${PIZZLY_VERSION} ${QUAYIO_REGISTRY}/${QUAYIO_IMAGE}:$${tag} && \
docker push ${QUAYIO_REGISTRY}/${QUAYIO_IMAGE}:$${tag}; \
done