-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
53 lines (43 loc) · 1.25 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
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
APPVersion?=0.0.3
ContainerTagName?=justgps/excel
APP?=app
PORT?=11004
ImageName?=justgps/excel
ContainerName?=doreexcel
MKFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
CURDIR := $(dir $(MKFILE))
build:
go env -w GOPRIVATE=github.com/asccclass
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=off go build -tags netgo \
-ldflags "-s -w -X version.BuildTime=${BUILD_TIME}" \
-o ${APP}
docker: build
docker build -t ${ImageName}:${APPVersion} .
rm -f app
docker images
push: docker
docker tag ${ImageName}:${APPVersion} ${ImageName}:${APPVersion}
docker push ${ImageName}:${APPVersion}
run: docker
docker run --restart=always -d --name ${ContainerName} \
-v /etc/localtime:/etc/localtime:ro \
-v ${CURDIR}tmp:/tmp \
-v ${CURDIR}envfile:/app/envfile \
--env-file ./envfile \
-p ${PORT}:80 ${ImageName}:${APPVersion}
sh clean.sh
docker logs -f -t --tail 20 ${ContainerName}
stop:
docker stop ${ContainerName}
test:
curl -X POST -F "xlsx=@${CURDIR}2018.xlsx" https://devwteamapi.test5.sinica.edu.tw/excel/excel2json
log:
docker logs -f -t --tail 20 ${ContainerName}
rm:
docker rm ${ContainerName}
re:stop rm run
login:
docker exec -it ${ContainerName} /bin/sh
s:
git push -u origin master