-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (26 loc) · 943 Bytes
/
Makefile
File metadata and controls
31 lines (26 loc) · 943 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
BINARY=bootstrap-server
IMAGE=docker.crute.me/netboot-server
NETBOX_HOST ?= https://netbox.example.com
HTTP_SERVER ?= http://bootstrap.example.com
VAULT_PATH ?= path/to/netbox-readonly
DEFAULT_CONFIG ?= 1
$(BINARY): $(shell find . -name '*.go')
CGO_ENABLED=0 go build \
-ldflags " \
-X code.crute.us/mcrute/netboot-server/app.defaultNetboxHost=$(NETBOX_HOST) \
-X code.crute.us/mcrute/netboot-server/app.defaultHttpServer=$(HTTP_SERVER) \
-X code.crute.us/mcrute/netboot-server/app.defaultVaultNetboxPath=$(VAULT_PATH) \
-X code.crute.us/mcrute/netboot-server/app.defaultNetboxConfigId=$(DEFAULT_CONFIG) \
" \
-o $@
.PHONY: docker
docker: $(BINARY)
mkdir docker; cp Dockerfile $(BINARY) docker; cd docker; \
docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \
docker build --no-cache -t $(IMAGE):latest .
.PHONY: publish
publish:
docker push $(IMAGE):latest
.PHONY: clean
clean:
rm $(BINARY) || true