2020-05-20 14:07:58 +02:00
|
|
|
DOKKU_HOST := dokku@dev.lookingfora.name
|
|
|
|
SHELL := /bin/bash
|
2020-06-17 23:47:49 +02:00
|
|
|
DOCKER_IMAGE_NAME ?= bornholm/hydra-passwordless
|
2022-05-11 16:18:04 +02:00
|
|
|
DOCKER_IMAGE_TAG ?= $(shell git describe --always)
|
2020-05-20 14:07:58 +02:00
|
|
|
|
2020-09-08 11:40:25 +02:00
|
|
|
build:
|
|
|
|
CGO_ENABLED=0 go build -v -o bin/server ./cmd/server
|
2020-04-08 08:56:42 +02:00
|
|
|
|
|
|
|
test:
|
|
|
|
go test -v -race ./...
|
|
|
|
|
2020-09-08 11:40:25 +02:00
|
|
|
release:
|
2020-04-08 08:56:42 +02:00
|
|
|
@$(SHELL) ./misc/script/release.sh
|
|
|
|
|
|
|
|
tidy:
|
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
watch:
|
|
|
|
modd
|
|
|
|
|
|
|
|
lint:
|
|
|
|
golangci-lint run --enable-all
|
|
|
|
|
2020-04-24 09:27:07 +02:00
|
|
|
up:
|
|
|
|
docker-compose up --build
|
|
|
|
|
|
|
|
down:
|
|
|
|
docker-compose down -v --remove-orphans
|
2020-04-08 08:56:42 +02:00
|
|
|
|
2020-05-20 13:45:33 +02:00
|
|
|
create-default-client:
|
|
|
|
docker-compose exec \
|
|
|
|
-e HYDRA_URL=http://localhost:4445 \
|
|
|
|
hydra \
|
|
|
|
hydra clients create \
|
|
|
|
-c http://localhost:3002/oauth2/callback \
|
2020-05-26 11:11:53 +02:00
|
|
|
--post-logout-callbacks http://localhost:3002 \
|
|
|
|
-n "Default App" \
|
|
|
|
-a "openid" -a "email"
|
2020-05-20 13:45:33 +02:00
|
|
|
|
2020-04-24 09:27:07 +02:00
|
|
|
list-clients:
|
2020-05-20 13:45:33 +02:00
|
|
|
docker-compose exec \
|
|
|
|
-e HYDRA_URL=http://localhost:4445 \
|
|
|
|
hydra \
|
|
|
|
hydra clients list
|
|
|
|
|
|
|
|
hydra-interactive:
|
|
|
|
docker-compose exec \
|
|
|
|
-e HYDRA_URL=http://localhost:4445 \
|
|
|
|
hydra \
|
|
|
|
/bin/sh
|
2020-04-24 09:27:07 +02:00
|
|
|
|
2020-05-20 14:07:58 +02:00
|
|
|
dokku-build:
|
|
|
|
docker build \
|
|
|
|
-t hydra-passwordless-dokku:latest \
|
|
|
|
.
|
|
|
|
|
|
|
|
dokku-run:
|
|
|
|
docker run -it --rm -p 4444:4444 -p 3002:3002 hydra-passwordless-dokku:latest
|
|
|
|
|
|
|
|
dokku-deploy: dokku-deploy-passwordless dokku-deploy-sso
|
|
|
|
|
|
|
|
dokku-deploy-passwordless:
|
|
|
|
$(if $(shell git config remote.dokku-passwordless.url),, git remote add dokku-passwordless $(DOKKU_HOST):passwordless)
|
|
|
|
git push -f dokku-passwordless $(shell git rev-parse HEAD):refs/heads/master
|
|
|
|
|
|
|
|
dokku-deploy-sso:
|
|
|
|
$(if $(shell git config remote.dokku-sso.url),, git remote add dokku-sso $(DOKKU_HOST):sso)
|
|
|
|
git push -f dokku-sso $(shell git rev-parse HEAD):refs/heads/master
|
|
|
|
|
2020-06-17 23:47:49 +02:00
|
|
|
docker-build:
|
|
|
|
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 hydra-passwordless:latest \
|
|
|
|
-f ./misc/docker/Dockerfile \
|
|
|
|
.
|
|
|
|
|
|
|
|
docker-run:
|
|
|
|
docker run \
|
|
|
|
-it --rm \
|
|
|
|
-p 3000:3000 \
|
|
|
|
hydra-passwordless:latest
|
|
|
|
|
|
|
|
docker-release: docker-build
|
|
|
|
docker image tag hydra-passwordless:latest $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
2022-03-25 15:11:29 +01:00
|
|
|
docker image tag hydra-passwordless:latest $(DOCKER_IMAGE_NAME):latest
|
2020-06-17 23:47:49 +02:00
|
|
|
docker login
|
|
|
|
docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
2022-03-25 15:11:29 +01:00
|
|
|
docker push $(DOCKER_IMAGE_NAME):latest
|
2020-06-17 23:47:49 +02:00
|
|
|
|
2020-04-08 08:56:42 +02:00
|
|
|
clean:
|
|
|
|
rm -rf release
|
|
|
|
rm -rf data
|
|
|
|
rm -rf bin
|
|
|
|
|
2020-09-08 11:40:25 +02:00
|
|
|
.PHONY: lint watch build tidy release
|