Skip to content

Commit

Permalink
add run target to makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
trusch committed Oct 16, 2020
1 parent ac081cc commit 2cb3268
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 2cb3268

Please sign in to comment.