-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
103 lines (75 loc) · 2.92 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
SHORT_TTL := 3600
# for assets, which don't change or have hashed filenames
LONG_TTL := 86400
.PHONY: server docker
all: install build
install:
dep ensure
yarn install
build: build-assets build-go
dev: clean build watch
make -j file-server watch-logs
# See https://github.com/webpack/webpack/issues/2537#issuecomment-280447557
prod: clean
NODE_ENV=production webpack -p
go install
$(GOPATH)/bin/photoswipestory
test:
go test ./go/...
push-docker-deploy:
git push origin master
make docker-deploy
deploy:
aws s3 sync $(GENERATED_PATH) s3://$(S3_BUCKET)/ --cache-control max-age=$(SHORT_TTL) --delete --content-type text/html --exclude '$(ASSETS_PATH)/*' --exclude '*.*' --include '*.html'
aws s3 sync $(GENERATED_PATH)/$(ASSETS_PATH) s3://$(S3_BUCKET)/$(ASSETS_PATH)/ --cache-control max-age=$(LONG_TTL) --delete
aws s3 cp $(GENERATED_PATH)/robots.txt s3://$(S3_BUCKET)/ --cache-control max-age=$(SHORT_TTL) --content-type text/plain
find $(GENERATED_PATH) -name '*.atom' | sed "s|^\$(GENERATED_PATH)/||" | xargs -I{} -n1 aws s3 cp $(GENERATED_PATH)/{} s3://$(S3_BUCKET)/{} --cache-control max-age=$(SHORT_TTL) --content-type application/xml
aws s3 cp $(GENERATED_PATH)/favicon.ico s3://$(S3_BUCKET)/ --cache-control max-age=$(LONG_TTL) --content-type image/x-icon
aws s3 cp $(GENERATED_PATH)/browserconfig.xml s3://$(S3_BUCKET)/ --cache-control max-age=$(LONG_TTL) --content-type application/xml
docker-install: docker-build-install docker-copy
docker-build-install:
docker-compose up --no-start
# $(shell docker-compose ps -q web) breaks if this target is combined with docker-build
DEP_MANAGER_PATHS := node_modules vendor yarn.lock Gopkg.lock
docker-copy:
$(foreach dep_path,$(DEP_MANAGER_PATHS),docker cp $(shell docker-compose ps -q web):$(DOCKER_WORKDIR)/$(dep_path) ./$(dep_path);)
docker-build:
docker-compose up --build --no-start
docker:
docker-compose -f docker-compose.yml -f docker/docker-compose.dev.yml up
docker-prod:
docker-compose -f docker-compose.yml -f docker/docker-compose.prod.yml up
docker-test:
docker-compose -f docker-compose.yml -f docker/docker-compose.test.yml up --exit-code-from web
docker-deploy:
docker-compose -f docker-compose.yml -f docker/docker-compose.deploy.yml up
docker-run-sh:
docker-compose -f docker-compose.yml -f docker/docker-compose.dev.yml run web ash
docker-sh:
docker-compose exec web ash
docker-rm:
docker-compose rm -v -s
clean:
rm -rf $(GENERATED_PATH) ./node_modules/.cache/
watchman watch-del-all
watchman shutdown-server
clean-all: clean
rm -rf cache
server: build-assets
go install
$(GOPATH)/bin/photoswipestory -server
file-server:
$(GOPATH)/bin/photoswipestory -file-server
build-go:
go install
$(GOPATH)/bin/photoswipestory
build-assets:
webpack --color
watch:
watchman watch-project .
watchman -j < watchman/build-go.json
watchman -j < watchman/build-assets.json
watch-logs:
mkdir -p logs
touch logs/watchman-build.log
tail -f logs/watchman-build.log