71 lines
1.6 KiB
Makefile
71 lines
1.6 KiB
Makefile
|
SHELL := /bin/bash
|
||
|
IMAGE_REPO ?= reg.cadoles.com/wpetit/hydra-webauthn
|
||
|
|
||
|
build:
|
||
|
CGO_ENABLED=0 go build -v -o bin/server ./cmd/server
|
||
|
|
||
|
test:
|
||
|
go test -v -race ./...
|
||
|
|
||
|
tidy:
|
||
|
go mod tidy
|
||
|
|
||
|
watch: tools/modd/bin/modd .env
|
||
|
( set -o allexport && source .env && set +o allexport && tools/modd/bin/modd )
|
||
|
|
||
|
.env:
|
||
|
cp .env.dist .env
|
||
|
|
||
|
lint:
|
||
|
golangci-lint run --enable-all
|
||
|
|
||
|
up:
|
||
|
docker-compose up --build
|
||
|
|
||
|
down:
|
||
|
docker-compose down -v --remove-orphans
|
||
|
rm -rf data/storage.sqlite*
|
||
|
|
||
|
build-image:
|
||
|
docker build \
|
||
|
--build-arg="HTTP_PROXY=$(HTTP_PROXY)" \
|
||
|
--build-arg="HTTPS_PROXY=${HTTP_PROXY}" \
|
||
|
--build-arg="https_proxy=${https_proxy}" \
|
||
|
--build-arg="http_proxy=${http_proxy}" \
|
||
|
-t ${IMAGE_REPO}:latest \
|
||
|
-f ./misc/docker/Dockerfile \
|
||
|
.
|
||
|
|
||
|
run-image:
|
||
|
docker run \
|
||
|
-it --rm \
|
||
|
-p 3000:3000 \
|
||
|
${IMAGE_REPO}:latest
|
||
|
|
||
|
release-image: .mktools build-image
|
||
|
@[ ! -z "$(MKT_PROJECT_VERSION)" ] || ( echo "Just downloaded mktools. Please re-run command."; exit 1 )
|
||
|
docker tag "${IMAGE_REPO}:latest" "${IMAGE_REPO}:$(MKT_PROJECT_VERSION)"
|
||
|
docker tag "${IMAGE_REPO}:latest" "${IMAGE_REPO}:$(MKT_PROJECT_SHORT_VERSION)"
|
||
|
docker push "${IMAGE_REPO}:$(MKT_PROJECT_VERSION)"
|
||
|
docker push "${IMAGE_REPO}:$(MKT_PROJECT_SHORT_VERSION)"
|
||
|
docker push "${IMAGE_REPO}:latest"
|
||
|
|
||
|
clean:
|
||
|
rm -rf release
|
||
|
rm -rf data
|
||
|
rm -rf bin
|
||
|
|
||
|
release:
|
||
|
@$(SHELL) ./misc/script/release.sh
|
||
|
|
||
|
.PHONY: lint watch build tidy release
|
||
|
|
||
|
tools/modd/bin/modd:
|
||
|
mkdir -p tools/modd/bin
|
||
|
GOBIN=$(PWD)/tools/modd/bin go install github.com/cortesi/modd/cmd/modd@latest
|
||
|
|
||
|
.mktools:
|
||
|
rm -rf .mktools
|
||
|
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | TASKS="version" $(SHELL)
|
||
|
|
||
|
-include .mktools/*.mk
|