feat: Scaffolding bot

This commit is contained in:
2025-07-26 17:18:41 -07:00
parent 4acfd33eae
commit 8d3bcbc01d
10 changed files with 443 additions and 18 deletions
+46 -6
View File
@@ -4,19 +4,23 @@
# VARIABLES
# ====================================================================================
# --- Application Configuration ---
BINARY_NAME=crawler
# --- Docker & GCP Configuration ---
# IMPORTANT: Replace with your actual GCP Project ID.
GCP_PROJECT_ID=
GCP_PROJECT_ID=aimaren
GCR_HOSTNAME=gcr.io
IMAGE_NAME=hermes-crawler
IMAGE_TAG=latest
# This variable constructs the full image URL.
# --- Crawler Configuration ---
BINARY_NAME=crawler
IMAGE_NAME=hermes-crawler
IMAGE_URL=$(GCR_HOSTNAME)/$(GCP_PROJECT_ID)/$(IMAGE_NAME):$(IMAGE_TAG)
# --- Bot Configuration ---
BOT_BINARY_NAME=bot
BOT_IMAGE_NAME=hermes-bot
BOT_IMAGE_URL=$(GCR_HOSTNAME)/$(GCP_PROJECT_ID)/$(BOT_IMAGE_NAME):$(IMAGE_TAG)
# This allows passing arguments to the `run` command, e.g., `make run ARGS="-debug"`
ARGS=""
@@ -72,4 +76,40 @@ deploy: docker-push ## ☁️ Deploy the application as a Cloud Run Job
--region="us-central1" \
--cpu="1" \
--memory="512Mi" \
--task-timeout="5m"
--task-timeout="5m"
# =============================
# BOT SPECIFIC CONFIG
# =============================
.PHONY: bot-build bot-run bot-clean bot-docker-build bot-docker-push bot-deploy
bot-build: ## 🛠️ Build the Go binary for the webhook bot
@echo "--> Building Go bot binary..."
@go build -o $(BOT_BINARY_NAME) ./cmd/bot
bot-run: bot-build ## 🚀 Run the bot locally
@echo "--> Running bot locally..."
@./$(BOT_BINARY_NAME)
bot-clean: ## 🗑️ Clean bot binary
@echo "--> Cleaning bot binary..."
@rm -f $(BOT_BINARY_NAME)
bot-docker-build: ## 🐳 Build the bot Docker image
@echo "--> Building Docker image for bot: $(BOT_IMAGE_URL)"
@docker build -f Dockerfile.bot -t $(BOT_IMAGE_URL) .
bot-docker-push: bot-docker-build ## ⬆️ Push the bot image
@echo "--> Pushing bot image: $(BOT_IMAGE_URL)"
@docker push $(BOT_IMAGE_URL)
bot-deploy: bot-docker-push ## ☁️ Deploy the bot to Cloud Run
@echo "--> Deploying bot to Cloud Run..."
@gcloud run deploy $(BOT_IMAGE_NAME) \
--image=$(BOT_IMAGE_URL) \
--region=us-central1 \
--platform=managed \
--allow-unauthenticated \
--cpu=1 \
--memory=512Mi \
--port=8080