goweb-oidc/Makefile

81 lines
2.1 KiB
Makefile
Raw Permalink Normal View History

2020-05-20 19:29:13 +02:00
SHELL := /bin/bash
IMAGE_NAME ?= reg.cadoles.com/cadoles/oidc-test
MKT_GITEA_RELEASE_ORG ?= Cadoles
MKT_GITEA_RELEASE_PROJECT ?= goweb-oidc
MKT_GITEA_RELEASE_VERSION ?= $(MKT_PROJECT_VERSION)
define MKT_GITEA_RELEASE_BODY
## Docker usage
```
docker pull $(IMAGE_NAME):$(MKT_PROJECT_VERSION)
```
endef
export MKT_GITEA_RELEASE_BODY
2020-05-20 10:43:12 +02:00
2020-05-20 19:29:13 +02:00
build:
2020-10-13 10:59:41 +02:00
CGO_ENABLED=0 go build -v -o ./bin/server ./cmd/server
2020-05-20 10:43:12 +02:00
test:
go test -v -race ./...
tidy:
go mod tidy
watch:
modd
lint:
golangci-lint run --enable-all
clean:
rm -rf release
rm -rf data
rm -rf bin
build-image:
2020-05-20 19:29:13 +02:00
docker build \
-t "${IMAGE_NAME}:latest" \
-f ./misc/docker/Dockerfile \
2020-05-20 19:29:13 +02:00
.
scan: build-image tools/trivy/bin/trivy
mkdir -p .trivy
tools/trivy/bin/trivy --cache-dir .trivy/.cache image --ignorefile .trivyignore.yaml $(TRIVY_ARGS) $(IMAGE_NAME):latest
tools/trivy/bin/trivy:
mkdir -p tools/trivy/bin
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b ./tools/trivy/bin v0.47.0
2020-05-20 19:29:13 +02:00
release: release-image release-gitea
2020-05-20 19:29:13 +02:00
release-archive:
@$(SHELL) ./misc/script/release.sh
2022-04-20 15:30:50 +02:00
release-gitea: .mktools release-archive
@[ ! -z "$(MKT_PROJECT_VERSION)" ] || ( echo "Just downloaded mktools. Please re-run command."; exit 1 )
$(MAKE) MKT_GITEA_RELEASE_ATTACHMENTS="$$(find release/* -maxdepth 0 -type f -printf '%p ')" mkt-gitea-release
release-image: .mktools build-image
@[ ! -z "$(MKT_PROJECT_VERSION)" ] || ( echo "Just downloaded mktools. Please re-run command."; exit 1 )
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:$(MKT_PROJECT_VERSION)"
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:$(MKT_PROJECT_SHORT_VERSION)"
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:$(MKT_PROJECT_VERSION_CHANNEL)-latest"
docker push "${IMAGE_NAME}:$(MKT_PROJECT_VERSION)"
docker push "${IMAGE_NAME}:$(MKT_PROJECT_SHORT_VERSION)"
docker push "${IMAGE_NAME}:$(MKT_PROJECT_VERSION_CHANNEL)-latest"
.PHONY: lint watch build tidy release
2023-11-02 18:46:46 +01:00
.PHONY: mktools
mktools:
rm -rf .mktools
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
.mktools:
$(MAKE) mktools
-include .mktools/*.mk