-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (28 loc) · 1.04 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
.PHONY: build exec start stop restart logs
BUILD_TIME=$(shell date +%Y%m%d%H%M%S)
PWD=$(shell pwd)
DOCKER_IMAGE=blogserver
dev: rebuild
docker-compose -f docker-compose.yml up --remove-orphans
rebuild:
docker-compose -f docker-compose.yml build
build_server:
docker build -t $(DOCKER_IMAGE):latest -f server.dockerfile .
run_server: stop_server
docker run --name blogserver -p 4000:4000 -d $(DOCKER_IMAGE):latest
stop_server:
docker stop blogserver; docker rm -f blogserver; true
push: build_server
docker tag $(DOCKER_IMAGE):latest lutaoact/$(DOCKER_IMAGE):latest
docker push lutaoact/$(DOCKER_IMAGE):latest
docker tag $(DOCKER_IMAGE):latest lutaoact/$(DOCKER_IMAGE):$(BUILD_TIME)
docker push lutaoact/$(DOCKER_IMAGE):$(BUILD_TIME)
exec:
docker exec -it blog bash
exec_server:
docker exec -it blogserver bash
serverlog:
docker logs -f blogserver
remote_update:
ssh s 'docker rmi -f $(DOCKER_IMAGE)' && docker save $(DOCKER_IMAGE):latest | ssh s 'docker load'
echo 'docker run --restart always --name blogserver -p 4000:4000 -d blogserver'