forked from docker/dockercraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (35 loc) · 940 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
.PHONY: all test test-local install-deps lint fmt vet build serve
REPO_NAME = dockercraft
REPO_OWNER = docker
PKG_NAME = github.com/${REPO_OWNER}/${REPO_NAME}
IMAGE = golang:1.8
IMAGE_NAME = dockercraft-dev
CONTAINER_NAME = dockercraft-dev-container
PACKAGES=$(shell go list ./... | grep -v vendor)
all: test
test-local: install-deps fmt lint vet
@echo "+ $@"
@go test -v .
test:
@docker run -v ${shell pwd}:/go/src/${PKG_NAME} -w /go/src/${PKG_NAME} ${IMAGE} make test-local
install-deps:
@echo "+ $@"
@go get -u github.com/golang/lint/golint
lint:
@echo "+ $@"
@test -z "$$(golint $(PACKAGES) | tee /dev/stderr)"
fmt:
@echo "+ $@"
@test -z "$$(gofmt -s -l *.go | tee /dev/stderr)"
vet:
@echo "+ $@"
go vet $(PACKAGES)
build:
@echo "+ $@"
@docker build -t ${IMAGE_NAME} .
serve:
@docker run -it --rm \
--name ${CONTAINER_NAME} \
-p 25565:25565 \
-v /var/run/docker.sock:/var/run/docker.sock \
${IMAGE_NAME}