-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
76 lines (63 loc) · 1.95 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
74
75
76
pack ::= public.tgz
unpackDir ::= "~/fairchess"
pwd ::= $(shell pwd)
user ::= $(shell id -u)
group ::= $(shell id -g)
buildContainer = fairchess-build
updateContainer = fairchess-lock-update
audit: build-container
podman run --rm ${buildContainer} npm audit
build: Dockerfile lint build-container
-rm -r dist
mkdir -p dist
podman run \
--name ${buildContainer} \
-v ${pwd}/render.js:/build/render.js:ro \
-v ${pwd}/src/:/build/src/:ro \
-v ${pwd}/dist/:/build/dist/ \
${buildContainer} node render.js
podman cp ${buildContainer}:/build/dist/ dist/
podman stop ${buildContainer}
podman rm ${buildContainer}
cp -r src/public/js/chessboardjs dist/js
cp -r src/public/img dist/img
cp -r src/public/css dist/css
build-container: Dockerfile
podman build -t ${buildContainer} .
clean:
-rm -r dist node_modules ${pack}
deploy: clean build package upload
gh-pages: clean build
-git branch -D gh-pages
git checkout -b gh-pages
git rm --cached COPYING
git reset --hard `git rev-list --max-parents=0 HEAD`
find . -maxdepth 1 ! -name 'dist' ! -name '.git' ! -name 'COPYING' -exec rm -r {} \;
git add dist COPYING
git mv dist/* .
rm -r dist
git commit -am "website"
git push -f --set-upstream origin gh-pages
lint:
podman run --rm -v ${pwd}:/data:ro docker.io/cytopia/eslint .
package: build
cd dist && tar -czf ../${pack} .
serve: build
cd dist && python3 -m http.server
test: lint
update: package.json
-podman stop ${updateContainer}
-podman rm ${updateContainer}
podman run \
--name ${updateContainer} \
-v ${pwd}/package.json:/package.json:ro \
-w / \
docker.io/node:16-alpine npm install --package-lock
podman cp ${updateContainer}:/package-lock.json .
podman stop ${updateContainer}
podman rm ${updateContainer}
upload: package
-ssh fairchess "cd ${unpackDir} && rm -r *"
scp ${pack} fairchess:${unpackDir}
ssh fairchess "cd ${unpackDir} && tar -xzf ${pack} && rm ${pack}"
.PHONY: build clean deploy lint package serve test update upload