forked from inloop/devopscli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
52 lines (44 loc) · 1.58 KB
/
makefile
File metadata and controls
52 lines (44 loc) · 1.58 KB
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
OWNER=novacloud
IMAGE_NAME=devops
QNAME=$(OWNER)/$(IMAGE_NAME)
GIT_TAG=$(QNAME):$(GITHUB_SHA)
BUILD_TAG=$(QNAME):0.1.$(GITHUB_RUN_NUMBER)
LATEST_TAG=$(QNAME):latest
lint:
docker run -it --rm -v "$(PWD)/Dockerfile:/Dockerfile:ro" redcoolbeans/dockerlint
build:
# go get ./...
# gox -osarch=z"linux/amd64" -output="bin/devops-alpine"
GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/devops-alpine .
docker build -t $(GIT_TAG) .
docker build -t $(GIT_TAG)-golang -f Dockerfile.golang .
docker build -t $(GIT_TAG)-aws -f Dockerfile.aws .
docker build -t $(GIT_TAG)-mysql -f Dockerfile.mysql .
docker build -t $(GIT_TAG)-docker-compose -f Dockerfile.docker-compose .
tag:
docker tag $(GIT_TAG) $(BUILD_TAG)
docker tag $(GIT_TAG)-golang $(BUILD_TAG)-golang
docker tag $(GIT_TAG)-aws $(BUILD_TAG)-aws
docker tag $(GIT_TAG)-mysql $(BUILD_TAG)-mysql
docker tag $(GIT_TAG)-docker-compose $(BUILD_TAG)-docker-compose
docker tag $(GIT_TAG) $(LATEST_TAG)
docker tag $(GIT_TAG)-golang $(LATEST_TAG)-golang
docker tag $(GIT_TAG)-aws $(LATEST_TAG)-aws
docker tag $(GIT_TAG)-mysql $(LATEST_TAG)-mysql
docker tag $(GIT_TAG)-docker-compose $(LATEST_TAG)-docker-compose
login:
@docker login -u "$(DOCKER_USER)" -p "$(DOCKER_PASSWORD)"
push: login
# docker push $(GIT_TAG)
# docker push $(BUILD_TAG)
docker push $(LATEST_TAG)
docker push $(LATEST_TAG)-golang
docker push $(LATEST_TAG)-aws
docker push $(LATEST_TAG)-mysql
docker push $(LATEST_TAG)-docker-compose
build-local:
# go get ./...
go build -o devops
deploy-local:
make build-local
mv devops /usr/local/bin/