forked from atakanyenel/cwa-verification-fake
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
34 lines (26 loc) · 1.05 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
IMAGE_VERSION=0.1
IMAGE_NAME=cwa-verification-fake
IMAGE_ID=$(IMAGE_NAME):$(IMAGE_VERSION)
ACCOUNT?="please-set-env-var"
AUTHOR?="please-set-env-var"
all-push-to-github-registry: build tag push
build:
docker build -t $(IMAGE_ID) .
tag:
docker tag $(IMAGE_ID) docker.pkg.github.com/$(ACCOUNT)/$(IMAGE_NAME)/$(IMAGE_ID)
docker tag $(IMAGE_ID) docker.pkg.github.com/$(ACCOUNT)/$(IMAGE_NAME)/$(IMAGE_NAME):latest
login:
test -f "./GH_TOKEN.txt" || { echo "add ./GH_TOKEN.txt with a personal access token"; exit 1;}
cat ./GH_TOKEN.txt | docker login docker.pkg.github.com -u $(AUTHOR) --password-stdin
push: login
docker push docker.pkg.github.com/$(ACCOUNT)/$(IMAGE_NAME)/$(IMAGE_ID)
docker push docker.pkg.github.com/$(ACCOUNT)/$(IMAGE_NAME)/$(IMAGE_NAME):latest
run: export delayMillis=$(filter-out $@,$(MAKECMDGOALS))
run: build
@if [ -z $${delayMillis} ]; then \
docker run --publish 8004 $(IMAGE_ID); \
else \
docker run --publish 8004 --env CWA_FAKE_DELAY_MILLIS=$${delayMillis} $(IMAGE_ID); fi
# some magic to get makefile parameters working
%:
@: