From 2cb3268137c2e841289fb87acca630c585c32f86 Mon Sep 17 00:00:00 2001 From: Tino Rusch Date: Fri, 16 Oct 2020 08:15:52 +0200 Subject: [PATCH] add run target to makefile --- Makefile | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 746c628..3ea2d0c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ IMAGE=container.trusch.io/caddy-extauth/caddy:latest -DUMMY_AUTH_IMAGE=container.trusch.io/caddy-extauth/dummy-auth:latest -HTTP_LOGGER_IMAGE=container.trusch.io/caddy-extauth/http-logger:latest +DUMMY_AUTH_IMAGE=containers.trusch.io/caddy-extauth/dummy-auth:latest +HTTP_LOGGER_IMAGE=containers.trusch.io/caddy-extauth/http-logger:latest BASE_IMAGE=gcr.io/distroless/base-debian10:latest -BUILD_IMAGE=container.trusch.io/caddy-extauth/builder +BUILD_IMAGE=containers.trusch.io/caddy-extauth/builder BUILD_BASE_IMAGE=golang:1.15 all: image dummy-auth-image http-logger-image @@ -13,9 +13,6 @@ bin/caddy: extauth.go .build-image --rm \ -v ./:/app \ -w /app \ - -e GOOS=${GOOS} \ - -e GOARCH=${GOARCH} \ - -e GOARM=${GOARM} \ -v go-build-cache:/root/.cache/go-build \ -v go-mod-cache:/go/pkg/mod $(BUILD_IMAGE) bash -c \ "xcaddy build master --with github.com/trusch/caddy-extauth/pkg/extauth=/app && mv caddy bin/caddy" @@ -26,9 +23,6 @@ bin/http-logger: cmd/http-logger/main.go --rm \ -v ./:/app \ -w /app \ - -e GOOS=${GOOS} \ - -e GOARCH=${GOARCH} \ - -e GOARM=${GOARM} \ -v go-build-cache:/root/.cache/go-build \ -v go-mod-cache:/go/pkg/mod $(BUILD_IMAGE) \ go build -o $@ ./cmd/http-logger @@ -39,9 +33,6 @@ bin/dummy-auth: cmd/dummy-auth/main.go --rm \ -v ./:/app \ -w /app \ - -e GOOS=${GOOS} \ - -e GOARCH=${GOARCH} \ - -e GOARM=${GOARM} \ -v go-build-cache:/root/.cache/go-build \ -v go-mod-cache:/go/pkg/mod $(BUILD_IMAGE) \ go build -o $@ ./cmd/dummy-auth @@ -80,5 +71,20 @@ http-logger-image: .http-logger-image buildah rm $(ID) touch .http-logger-image -clean: +POD_NAME=caddy-extauth +run: .image .dummy-auth-image .http-logger-image + podman pod create --name $(POD_NAME) -p 2015:2015 --replace + podman run --name $(POD_NAME)-caddy -d --pod $(POD_NAME) \ + -v ./Caddyfile:/Caddyfile \ + --add-host auth:127.0.0.1 \ + --add-host logger:127.0.0.1 \ + $(IMAGE) caddy run -config /Caddyfile + podman run --name $(POD_NAME)-auth -d --pod $(POD_NAME) $(DUMMY_AUTH_IMAGE) + podman run --name $(POD_NAME)-logger -d --pod $(POD_NAME) $(HTTP_LOGGER_IMAGE) + +stop: + -podman pod stop -t 1 $(POD_NAME) + -podman pod rm -f $(POD_NAME) + +clean: stop -rm -r .build-image .image .http-logger-image .dummy-auth-image bin