middleware-manager/Makefile
2025-04-13 22:54:56 +05:30

66 lines
No EOL
1.3 KiB
Makefile

.PHONY: build build-ui build-backend run clean docker-build docker-push test
# Variables
APP_NAME := middleware-manager
DOCKER_REPO := hhftechnology
DOCKER_TAG := latest
GO_FILES := $(shell find . -name "*.go" -not -path "./vendor/*")
# Default target
all: build
# Build everything
build: build-ui build-backend
# Build UI
build-ui:
@echo "Building UI..."
cd ui && npm install && npm run build
# Build backend
build-backend:
@echo "Building backend..."
go build -o $(APP_NAME) .
# Run the application
run: build
@echo "Running application..."
./$(APP_NAME)
# Clean build artifacts
clean:
@echo "Cleaning..."
rm -f $(APP_NAME)
rm -rf ui/build
# Build Docker image
docker-build: build
@echo "Building Docker image..."
docker build -t $(DOCKER_REPO)/$(APP_NAME):$(DOCKER_TAG) .
# Push Docker image
docker-push: docker-build
@echo "Pushing Docker image..."
docker push $(DOCKER_REPO)/$(APP_NAME):$(DOCKER_TAG)
# Run tests
test:
@echo "Running tests..."
go test -v ./...
# Run the application in development mode
dev:
@echo "Running in development mode..."
go run main.go
# Run the UI in development mode
dev-ui:
@echo "Running UI in development mode..."
cd ui && npm start
# Install dependencies
deps:
@echo "Installing Go dependencies..."
go mod download
@echo "Installing UI dependencies..."
cd ui && npm install