88 lines
3.1 KiB
Makefile
88 lines
3.1 KiB
Makefile
ROOT_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
|
|
|
|
DOCKER_REGISTRY=hub.anxietyprime.de/
|
|
|
|
KEYCLOAK_BASE=quay.io/keycloak/keycloak:24.0.4
|
|
KEYCLOAK_DB_BASE=postgres:alpine3.18
|
|
|
|
KEYCLOAK=swa-jodel/keycloak:latest
|
|
KEYCLOAK_DB=swa-jodel/keycloak-db:latest
|
|
|
|
FRONTEND=swa-jodel/frontend:latest
|
|
BACKEND=swa-jodel/backend:latest
|
|
DATABASE=swa-jodel/database:latest
|
|
|
|
help:
|
|
@echo "[HELP]"
|
|
@echo "usage: make <command>"
|
|
@echo " help this page"
|
|
@echo " env create the env files"
|
|
@echo " build build the docker images"
|
|
@echo " clean remove for the build required data"
|
|
@echo " uninstall remove the docker images"
|
|
|
|
.PHONY = env
|
|
env:
|
|
@echo -e "POSTGRES_USER=\nPOSTGRES_PASSWORD=\n\n\nPOSTGRES_IP=10.42.0.19\nPOSTGRES_DB=Jodel" \
|
|
> .backend-env
|
|
@echo -e "POSTGRES_USER=\nPOSTGRES_PASSWORD=\n\nKEYCLOAK_ADMIN=\nKEYCLOAK_ADMIN_PASSWORD=\n\n\nKC_HOSTNAME=keycloak.local.anxietyprime.de\n\nPOSTGRES_IP=10.42.0.11\nPOSTGRES_DB=keycloak\nKC_DB_URL_DATABASE=\$$POSTGRES_IP\nKC_DB_USERNAME=\$$POSTGRES_USER\nKC_DB_PASSWORD=\$$POSTGRES_PASSWORD" \
|
|
> .keycloak-env
|
|
|
|
.PHONY = gitsync
|
|
gitsync:
|
|
git --git-dir=$(ROOT_DIR)SWA-frontend/.git pull || git --git-dir=$(ROOT_DIR) clone https://git.anxietyprime.de/SWA-Project/SWA-frontend.git
|
|
git --git-dir=$(ROOT_DIR)SWA-backend/.git pull || git --git-dir=$(ROOT_DIR) clone https://git.anxietyprime.de/SWA-Project/SWA-backend.git
|
|
git --git-dir=$(ROOT_DIR)SWA-database/.git pull || git --git-dir=$(ROOT_DIR) clone https://git.anxietyprime.de/SWA-Project/SWA-database.git
|
|
@echo "done"
|
|
|
|
.PHONY = build
|
|
build: uninstall frontend backend database keycloak
|
|
|
|
.PHONY = frontend
|
|
frontend: gitsync
|
|
docker buildx build --tag $(DOCKER_REGISTRY)$(FRONTEND) --load $(ROOT_DIR)SWA-frontend
|
|
|
|
.PHONY = backend
|
|
backend: gitsync
|
|
docker buildx build --tag $(DOCKER_REGISTRY)$(BACKEND) --load $(ROOT_DIR)SWA-backend
|
|
|
|
.PHONY = database
|
|
database: gitsync
|
|
docker buildx build --tag $(DOCKER_REGISTRY)$(DATABASE) --load $(ROOT_DIR)SWA-database
|
|
|
|
.PHONY = keycloak
|
|
keycloak:
|
|
docker pull $(KEYCLOAK_BASE)
|
|
@docker tag $(KEYCLOAK_BASE) $(DOCKER_REGISTRY)$(KEYCLOAK)
|
|
|
|
docker pull $(KEYCLOAK_DB_BASE)
|
|
@docker tag $(KEYCLOAK_DB_BASE) $(DOCKER_REGISTRY)$(KEYCLOAK_DB)
|
|
|
|
.PHONY = clean
|
|
clean:
|
|
@rm -fr $(ROOT_DIR)SWA-frontend $(ROOT_DIR)SWA-backend $(ROOT_DIR)SWA-database
|
|
@docker image rm $(KEYCLOAK_BASE) || true
|
|
@docker image rm $(KEYCLOAK_DB_BASE) || true
|
|
|
|
|
|
.PHONY = uninstall
|
|
uninstall:
|
|
@docker network rm -f swa-public || true
|
|
@docker network rm -f swa-keycloak || true
|
|
@docker network rm -f swa-keycloak-db || true
|
|
@docker network rm -f swa-database || true
|
|
@docker container rm -f swa-frontend || true
|
|
@docker container rm -f swa-backend || true
|
|
@docker container rm -f swa-database || true
|
|
@docker container rm -f swa-keycloak || true
|
|
@docker container rm -f swa-keycloak-db || true
|
|
@docker image rm -f $(DOCKER_REGISTRY)$(KEYCLOAK) || true
|
|
@docker image rm -f $(DOCKER_REGISTRY)$(KEYCLOAK_DB) || true
|
|
@docker image rm -f $(DOCKER_REGISTRY)$(FRONTEND) || true
|
|
@docker image rm -f $(DOCKER_REGISTRY)$(BACKEND) || true
|
|
@docker image rm -f $(DOCKER_REGISTRY)$(DATABASE) || true
|
|
|
|
.PHONY = yeet
|
|
yeet: build clean
|
|
@rm $(ROOT_DIR)Makefile
|