-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (26 loc) · 795 Bytes
/
Makefile
File metadata and controls
31 lines (26 loc) · 795 Bytes
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
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
export BUILD_PATH ?= $(ROOT_DIR)/_build
VERSION := $(shell git describe --tags --always)
ARCH := $(shell go env GOARCH)
OS := $(shell go env GOOS)
export PACKAGE_NAME := webservice-$(OS)-$(ARCH)
.PHONY: build
build: clean build_prepare
go build -o webservice cmd/main.go
@mv ./webservice $(BUILD_PATH)/$(PACKAGE_NAME)/bin
@echo "Build successfully"
.PHONY: build_prepare
build_prepare:
@mkdir -p $(BUILD_PATH)/$(PACKAGE_NAME)/bin
@mkdir -p $(BUILD_PATH)/$(PACKAGE_NAME)/etc
@mkdir -p $(BUILD_PATH)/$(PACKAGE_NAME)/log
@cp -r etc/* $(BUILD_PATH)/$(PACKAGE_NAME)/etc
.PHONY: docker
docker: clean
@ docker build \
-t webservice:$(VERSION) \
-f deploy/docker/Dockerfile \
.
.PHONY: clean
clean:
@rm -rf _build