-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
46 lines (35 loc) · 1.21 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
DOCKER_NAME=autoupdate-server
DOCKER_IMAGE=getlantern/$(DOCKER_NAME)
PRIVATE_KEY_DIR?=/etc/private
WORKDIR?=workdir
DEPLOY_URL ?= [email protected]
RUN_MODE ?=
clean:
rm -rf autoupdate-server patches assets workdir
docker:
docker build -t $(DOCKER_IMAGE) .
docker-run:
mkdir -p $(WORKDIR) && \
(docker stop $(DOCKER_NAME) || exit 0) && \
(docker rm $(DOCKER_NAME) || exit 0) && \
docker run -d \
-e RUN_MODE="$(RUN_MODE)" \
-p 127.0.0.1:9999:9999 \
--privileged \
-v $(WORKDIR):/app \
-v $(PRIVATE_KEY_DIR):/keys \
--restart always \
--memory-swappiness=0 \
--name $(DOCKER_NAME) \
$(DOCKER_IMAGE)
deploy: clean
rsync -av --delete --exclude "server/_tests" --exclude "server/assets" --exclude "server/patches" --exclude ".git" --exclude ".*.sw?" . $(DEPLOY_URL):~/deploy && \
ssh $(DEPLOY_URL) 'cd ~/deploy && make docker && PRIVATE_KEY_DIR=~/private WORKDIR=~/tmp make docker-run'
mock-server: docker
PRIVATE_KEY_DIR=$(PWD)/_resources/example-keys WORKDIR=/tmp RUN_MODE=mock $(MAKE) docker-run
mock-server-logs:
docker logs --tail 20 -f $(DOCKER_NAME)
production:
[email protected] make deploy
stage:
[email protected] make deploy