weather/Makefile

61 lines
1.8 KiB
Makefile

.PHONY: gen-cert build-weather build-poller gen-cert dev-dependencies cert-info cert-info-remote curl-test clean get-root-ca
.EXPORT_ALL_VARIABLES:
GOARCH=amd64
# GOARCH=arm
GOOS=darwin
# GOOS=linux
LDFLAGS=-w -s
GOBUILDFLAGS=
DOCKER_BUILDKIT=1
CGO_ENABLED=0
WEATHER_VERSION=latest
POLLER_VERSION=latest
build: build-poller build-weather
build-weather: dependencies
@echo "build for os $$GOOS and arch $$GOARCH"
go build -o bin/weather-$(GOOS)-$(GOARCH) cmd/weather/main.go
build-poller: dependencies
@echo "build for os $$GOOS and arch $$GOARCH"
go build -o bin/poller-$(GOOS)-$(GOARCH) -ldflags="$(LDFLAGS)" $(GOBUILDFLAGS) cmd/poller/main.go
gen-cert:
cfssl gencert -config certs/client-config.json -profile server -hostname weather.localdomain certs/client-csr.json | cfssljson -bare certs/out/weather
dependencies:
go mod download
go mod verify
dev-dependencies:
go get github.com/cloudflare/cfssl/cmd/cfssl
go get github.com/cloudflare/cfssl/cmd/cfssljson
go get github.com/cloudflare/cfssl/cmd/mkbundle
cert-info:
cfssl certinfo -cert certs/out/weather.pem
cert-info-remote:
cfssl certinfo -domain weather.localdomain:8080
curl-test:
curl --cacert certs/out/ca.pem https://weather.localdomain:8080
clean:
rm -rf bin/*
get-root-ca:
cfssl info -remote rasp1.localdomain:444 -config certs/client-config.json | cfssljson -bare -stdout /dev/stdout | tee certs/out/ca.pem
docker: docker-build-poller docker-build-weather docker-push
docker-build-poller:
docker build -t docker.registry:5000/weather/poller:$(POLLER_VERSION) -f DockerfilePoller .
docker-build-weather:
docker build -t docker.registry:5000/weather/server:$(WEATHER_VERSION) -f DockerfileWeather .
docker-push:
docker push docker.registry:5000/weather/poller:$(POLLER_VERSION)
docker push docker.registry:5000/weather/server:$(WEATHER_VERSION)