kanidm/Makefile
Pando85 c2f77a47f3 Create light images with static binaries
- Change base builder image to `ekidd/rust-musl-builder` for create static
binaries.
- Add two flavours: alpine and stand alone binary.
- Add makefile commands for build, test and push kanidmd images and
  refactor previous code.
- Add missing things to `.dockerignore`.
- Refactor CI to use Makefile.
2020-05-06 11:07:01 +10:00

55 lines
1.4 KiB
Makefile

.PHONY: help build/kanidmd build/radiusd test/kanidmd push/kanidmd push/radiusd vendor-prep doc install-tools prep
IMAGE_BASE ?= kanidm
IMAGE_VERSION ?= latest
.DEFAULT: help
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/\n\t/'
build/kanidmd: ## build kanidmd images
build/kanidmd:
@docker build -f kanidmd/Dockerfile -t $(IMAGE_BASE)/server:$(IMAGE_VERSION) .
@docker build -f kanidmd/Dockerfile \
--target alpine \
-t $(IMAGE_BASE)/server:$(IMAGE_VERSION)-alpine \
.
build/radiusd: ## build radiusd image
build/radiusd:
@docker build -f kanidm_rlm_python/Dockerfile -t $(IMAGE_BASE)/radius:$(IMAGE_VERSION) \
kanidm_rlm_python
test/kanidmd: ## test kanidmd
test/kanidmd:
@docker build -f kanidmd/Dockerfile \
--target builder \
-t $(IMAGE_BASE)/server:$(IMAGE_VERSION)-builder \
.
@docker run --rm $(IMAGE_BASE)/server:$(IMAGE_VERSION)-builder cargo test
push/kanidmd: ## push kanidmd images
push/kanidmd:
@docker push $(IMAGE_BASE)/server:$(IMAGE_VERSION)
@docker push $(IMAGE_BASE)/server:$(IMAGE_VERSION)-alpine
push/radiusd: ## push radiusd image
push/radiusd:
@docker push $(IMAGE_BASE)/radius:$(IMAGE_VERSION)
vendor-prep:
cargo vendor
tar -czf vendor.tar.gz vendor
doc: ## build doc local
doc:
cargo doc --document-private-items
install-tools: ## install tools in local environment
install-tools:
cd kanidm_tools && cargo install --path . --force
prep:
cargo outdated -R
cargo audit