Docker-Swarm-Loadbalancer/Makefile

60 lines
1.8 KiB
Makefile
Raw Permalink Normal View History

all: fix build-n-push
php-cs-fixer:
2024-01-25 13:01:25 +00:00
docker run --rm -v $(shell pwd):/data cytopia/php-cs-fixer fix
fix: php-cs-fixer
image_reference_devel:=ghcr.io/benzine-framework/bouncer:devel
2024-01-25 13:01:25 +00:00
build-n-push: fix
2024-01-05 17:15:51 +00:00
docker build \
2024-01-25 13:57:59 +00:00
--build-arg BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg GIT_SHA="$(shell git rev-parse HEAD)" \
--build-arg GIT_BUILD_ID="$(shell git rev-parse --abbrev-ref HEAD)-$(shell git describe --tags --dirty --always | sed -e 's/^v//')" \
2024-01-25 13:57:59 +00:00
--build-arg GIT_COMMIT_MESSAGE="$(shell git log -1 --pretty=%B | head -n1)" \
--build-context php:cli=docker-image://ghcr.io/benzine-framework/php:cli-8.2 \
2024-01-05 17:15:51 +00:00
--tag benzine/bouncer \
--tag $(image_reference_devel) \
2024-01-05 17:15:51 +00:00
--target bouncer \
--progress plain \
2024-01-05 17:15:51 +00:00
.
docker push $(image_reference_devel)
2022-05-05 14:42:53 +00:00
test-as-service: clean
docker build -t bouncer --target bouncer .
docker build -t test-app-a --target test-app-a .
docker build -t test-app-b --target test-app-b .
-docker network create --driver overlay bouncer-test
$(MAKE) start_bouncer
$(MAKE) start_test_a
$(MAKE) start_test_b
docker service logs -f bouncer
start_test_a:
docker service create \
--network bouncer-test \
--name test-app-a \
--env BOUNCER_DOMAIN=test-a.local \
--env BOUNCER_ALLOW_NON_SSL=yes \
--publish 8081:80 \
test-app-a
start_test_b:
docker service create \
--network bouncer-test \
--name test-app-b \
--env BOUNCER_DOMAIN=test-b.local \
--env BOUNCER_ALLOW_NON_SSL=yes \
--publish 8082:80 \
test-app-b
start_bouncer:
docker service create \
--network bouncer-test \
--name bouncer \
--publish 8080:80 \
--mount type=bind,destination=/var/run/docker.sock,source=/var/run/docker.sock \
bouncer
clean:
-docker service rm bouncer test-app-a test-app-b
#-docker network rm bouncer-test
2024-01-05 17:15:51 +00:00
#-docker image rm test-app-a test-app-b bouncer