-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (31 loc) · 1.18 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
repository=$(shell basename -s .git $(shell git config --get remote.origin.url))
user=hatlonely
version=$(shell git describe --tags)
.PHONY: buildenv
buildenv:
if [ -z "$(shell docker ps --filter name=vue-build-env -q)" ]; then \
docker run --name vue-build-env -d node:12.10.0-alpine tail -f /dev/null; \
fi
.PHONY: cleanbuildenv
cleanbuildenv:
if [ ! -z "$(shell docker ps --filter name=vue-build-env -q)" ]; then \
docker stop vue-build-env && docker rm vue-build-env; \
fi
.PHONY: image
image: buildenv
docker exec vue-build-env rm -rf /data/src/hpifu/${repository}
docker exec vue-build-env mkdir -p /data/src/hpifu/${repository}
docker cp . vue-build-env:/data/src/hpifu/${repository}
docker exec vue-build-env sh -c "cd /data/src/hpifu/${repository} && npm install && npm run build"
mkdir -p docker/
docker cp vue-build-env:/data/src/hpifu/${repository}/dist docker/
docker build --tag=hatlonely/${repository}:${version} .
cat stack.tpl.yml | sed 's/\$${version}/${version}/g' | sed 's/\$${repository}/${repository}/g' > stack.yml
.PHONY: deploy
deploy:
docker stack deploy -c stack.yml ${repository}
.PHONY: remove
remove:
docker stack rm ${repository}
dist:
npm run build