Skip to content

Commit

Permalink
Add local build and compose scripts/configurations
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar committed May 13, 2024
1 parent 623607b commit 1a48501
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ release.properties
# VS Code
.factorypath
.vscode

# User-provided and generated compose configurations
/compose-runtime.env
/console-config.yaml
/compose.env
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

.PHONY: container-image-api container-image-ui container-images

include *compose.env

CONSOLE_API_IMAGE ?= localhost/eyefloaters/console-api
CONSOLE_API_ACCOUNT ?= streams-console-service-account
CONSOLE_API_NS ?= default
CONSOLE_UI_IMAGE ?= localhost/eyefloaters/console-ui
CONSOLE_UI_NEXTAUTH_SECRET ?= $(shell openssl rand -base64 32)

container-image-api:
mvn package -f api/pom.xml -Pdocker -DskipTests -Dquarkus.container-image.image=$(CONSOLE_API_IMAGE)

container-image-ui:
docker build -t $(CONSOLE_UI_IMAGE) ./ui -f ./ui/Dockerfile

container-images: container-image-api container-image-ui

compose-up: container-images
> compose-runtime.env
echo "CONSOLE_API_IMAGE=$(CONSOLE_API_IMAGE)" >> compose-runtime.env
echo "CONSOLE_API_SERVICE_ACCOUNT_TOKEN=$(CONSOLE_API_SERVICE_ACCOUNT_TOKEN)" >> compose-runtime.env
echo "CONSOLE_API_KUBERNETES_API_SERVER_URL=$(CONSOLE_API_KUBERNETES_API_SERVER_URL)" >> compose-runtime.env
echo "CONSOLE_UI_IMAGE=$(CONSOLE_UI_IMAGE)" >> compose-runtime.env
echo "CONSOLE_UI_NEXTAUTH_SECRET=$(CONSOLE_UI_NEXTAUTH_SECRET)" >> compose-runtime.env
docker compose --env-file compose-runtime.env up -d

compose-down:
docker compose --env-file compose-runtime.env down
33 changes: 33 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
version: '3.9'

networks:
streams-console:
driver: bridge

services:
console-api:
image: ${CONSOLE_API_IMAGE}
hostname: api
container_name: console-api
volumes:
- ${PWD}/console-config.yaml:/deployments/console-config.yaml:z
environment:
CONSOLE_CONFIG_PATH: /deployments/console-config.yaml
QUARKUS_KUBERNETES_CLIENT_API_SERVER_URL: ${CONSOLE_API_KUBERNETES_API_SERVER_URL}
QUARKUS_KUBERNETES_CLIENT_TOKEN: ${CONSOLE_API_SERVICE_ACCOUNT_TOKEN}
networks:
- streams-console

console-ui:
image: ${CONSOLE_UI_IMAGE}
hostname: ui
container_name: console-ui
ports:
- "3000:3000"
environment:
NEXTAUTH_SECRET: ${CONSOLE_UI_NEXTAUTH_SECRET}
NEXTAUTH_URL: http://localhost:3000
BACKEND_URL: http://api:8080/
networks:
- streams-console

0 comments on commit 1a48501

Please sign in to comment.