forked from cesanta/docker_auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (48 loc) · 1.49 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
54
55
56
57
58
59
60
61
62
MAKEFLAGS += --warn-undefined-variables
IMAGE ?= cesanta/docker_auth
COMPRESS_BINARY ?= false
CA_BUNDLE = /etc/ssl/certs/ca-certificates.crt
VERSION = $(shell cat version.txt)
BUILDER_IMAGE ?= golang:1.15-alpine3.12
.PHONY: %
all: build
deps:
go get -v github.com/go-bindata/go-bindata/...
generate:
go generate \
github.com/cesanta/docker_auth/auth_server \
github.com/cesanta/docker_auth/auth_server/authn/... \
github.com/cesanta/docker_auth/auth_server/authz/... \
github.com/cesanta/docker_auth/auth_server/mgo_session/... \
github.com/cesanta/docker_auth/auth_server/server/...
build:
CGO_ENABLED=0 go build -v --ldflags=--s
ca-certificates.crt:
cp $(CA_BUNDLE) .
build-release: ca-certificates.crt
docker run --rm -v $(PWD)/..:/src \
$(BUILDER_IMAGE) sh -x -c "\
apk update && apk add git make py3-pip && pip install GitPython && \
cd /src/auth_server && \
umask 0 && \
go get -u github.com/go-bindata/go-bindata/... && \
make generate && \
CGO_ENABLED=0 go build -v --ldflags=--s"
@echo === Built version $$(cat version.txt) ===
auth_server:
@echo
@echo Use build or build-release to produce the auth_server binary
@echo
@exit 1
docker-build:
docker build -t $(IMAGE):latest .
docker tag $(IMAGE):latest $(IMAGE):$(VERSION)
docker-tag-%:
docker tag $(IMAGE):latest $(IMAGE):$*
docker-push:
docker push $(IMAGE):latest
docker push $(IMAGE):$(VERSION)
docker-push-%: docker-tag-%
docker push $(IMAGE):$*
clean:
rm -rf auth_server vendor/*/*