1
- include .cnf.makefile
2
1
2
+ APPVERSION := latest
3
3
GOVERSION := 1.15
4
4
PROGRAM := pg_tileserv
5
5
CONFIG := config/$(PROGRAM ) .toml
6
+ CONTAINER := pramsey/$(PROGRAM )
6
7
7
8
RM = /bin/rm
8
9
CP = /bin/cp
9
10
MKDIR = /bin/mkdir
10
11
11
- .PHONY : bin-docker build-docker buildx-docker build check clean docs install install-buildx release test uninstall
12
+ .PHONY : bin-docker build-docker build check clean docs install release test uninstall
12
13
13
14
.DEFAULT_GOAL := help
14
15
15
16
GOFILES := $(wildcard * .go)
16
17
17
18
all : $(PROGRAM )
18
19
19
- check : # # This checks the current version of Go installed locally
20
+ check : # # This checks the current version of Go installed locally
20
21
@go version
21
22
22
- clean : # # This will clean all local build artifacts
23
+ clean : # # This will clean all local build artifacts
23
24
$(info Cleaning project...)
24
25
@rm -f $(PROGRAM )
25
26
@rm -rf docs/*
26
27
docker image prune --force
27
28
28
- docs : # # Generate docs
29
+ docs : # # Generate docs
29
30
@rm -rf docs/* && cd hugo && hugo && cd ..
30
31
31
- build : $(GOFILES ) # # Build a local binary using APPVERSION parameter or CI as default
32
+ build : $(GOFILES ) # # Build a local binary using APPVERSION parameter or CI as default
32
33
go build -v -ldflags " -s -w -X main.programVersion=$( APPVERSION) "
33
34
34
- bin-docker : # # Build a local binary based off of a golang base docker image
35
+ bin-docker : # # Build a local binary based off of a golang base docker image
35
36
sudo docker run --rm -v " $( PWD) " :/usr/src/myapp:z -w /usr/src/myapp golang:$(GOVERSION ) make APPVERSION=$(APPVERSION ) build
36
37
37
- build-docker : $(PROGRAM ) Dockerfile # # Generate a CentOS 7 container with APPVERSION tag, using binary from current environment
38
- docker build -f $( DOCKERFILE ) --build-arg VERSION=$(APPVERSION ) -t $(REPO ) / $( PROGRAM ) :$(APPVERSION ) .
38
+ build-docker : $(PROGRAM ) Dockerfile # # Generate a CentOS 7 container with APPVERSION tag, using binary from current environment
39
+ docker build -f Dockerfile --build-arg VERSION=$(APPVERSION ) -t $(CONTAINER ) :$(APPVERSION ) .
39
40
40
- buildx-docker : # # Compiles multi-arch images and pushes them to a custom repository
41
- docker buildx build -f $(DOCKERFILE ) --platform=$(BUILDPLATFORM ) --build-arg VERSION=$(APPVERSION ) -t $(REPO ) /$(PROGRAM ) :$(APPVERSION ) --push .
41
+ release : clean docs build build-docker # # Generate the docs, a local build, and then uses the local build to generate a CentOS 7 container
42
42
43
- release : clean docs build build-docker # # Generate the docs, a local build, and then uses the local build to generate a CentOS 7 container
44
-
45
- test : # # Run the tests locally
43
+ test : # # Run the tests locally
46
44
go test -v
47
45
48
46
$(CONFIG ) : $(CONFIG ) .example
@@ -57,16 +55,12 @@ install: $(PROGRAM) docs $(CONFIG) ## This will install the program local
57
55
$(CP ) -r assets $(DESTDIR ) /usr/share/$(PROGRAM ) /assets
58
56
$(CP ) -r docs $(DESTDIR ) /usr/share/$(PROGRAM ) /docs
59
57
60
- install-buildx : # # This will install the buildx plugin for docker depending on the system
61
- wget -nc --quiet https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.$(uname_S ) -$(ARCH ) -P ~ /.docker/cli-plugins -O docker-buildx
62
- chmod a+x ~ /.docker/cli-plugins/docker-buildx
63
-
64
- uninstall : # # This will uninstall the program from your local system
58
+ uninstall : # # This will uninstall the program from your local system
65
59
$(RM ) $(DESTDIR ) /usr/bin/$(PROGRAM )
66
60
$(RM ) $(DESTDIR ) /etc/$(PROGRAM ) .toml
67
61
$(RM ) -r $(DESTDIR ) /usr/share/$(PROGRAM )
68
62
69
- help : # # Prints this help message
63
+ help : # # Prints this help message
70
64
@echo " "
71
65
@echo " "
72
66
@fgrep -h " ##" $(MAKEFILE_LIST ) | fgrep -v fgrep | sed -e ' s/\\$$//' | sed -e ' s/:.*##/:/'
0 commit comments