-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
50 lines (42 loc) · 1005 Bytes
/
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
PROJECT?=filewatch
RELEASE?=0.0.1
COMMIT?=$(shell git rev-parse --short HEAD)
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
APP?=app
PORT?=11002
ImageName?=filewatchImageName
ContainerName?=filewatchContainer
DBSERVER?=MySQLx
MKFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
CURDIR := $(dir $(MKFILE))
cleanDocker:
sh clean.sh
clean:
rm -f ${APP}
build:
GOOS=linux GOARCH=amd64 go build -tags netgo \
-ldflags "-s -w -X version.Release=${RELEASE} \
-X version.Commit=${COMMIT} \
-X version.BuildTime=${BUILD_TIME}" \
-o ${APP}
docker: build
docker build -t ${ImageName} .
rm -f ${APP}
docker images
runx: docker cleanDocker
docker run -d --name ${ContainerName} \
-v /etc/localtime:/etc/localtime:ro \
-v ${CURDIR}www:/app/www \
--restart=always \
-p ${PORT}:80 \
--link ${DBSERVER} \
--env-file ${CURDIR}envfile \
${ImageName}
run:
go run fwatcher.go
stop:
docker stop ${ContainerName}
log:
docker logs -f -t --tail 20 ${ContainerName}
rm:
docker rm ${ContainerName}