2023-04-06 09:47:30 +00:00
|
|
|
.PHONY: all install build_frontend build_backend build build_docker watch_frontend watch_backend watch clean clean_docker
|
2023-04-04 00:13:50 +00:00
|
|
|
|
|
|
|
# Specify the name of your Go binary output
|
|
|
|
BINARY_NAME := opengist
|
|
|
|
|
2023-04-06 09:47:30 +00:00
|
|
|
all: install build
|
2023-04-04 00:13:50 +00:00
|
|
|
|
2023-04-06 09:47:30 +00:00
|
|
|
install:
|
2023-04-04 00:13:50 +00:00
|
|
|
@echo "Installing NPM dependencies..."
|
|
|
|
@npm ci || (echo "Error: Failed to install NPM dependencies." && exit 1)
|
|
|
|
@echo "Installing Go dependencies..."
|
|
|
|
@go mod download || (echo "Error: Failed to install Go dependencies." && exit 1)
|
|
|
|
|
|
|
|
build_frontend:
|
|
|
|
@echo "Building frontend assets..."
|
|
|
|
./node_modules/.bin/vite build
|
|
|
|
|
|
|
|
build_backend:
|
|
|
|
@echo "Building Opengist binary..."
|
2023-04-06 09:47:30 +00:00
|
|
|
go build -tags fs_embed -o $(BINARY_NAME) .
|
|
|
|
|
|
|
|
build: build_frontend build_backend
|
2023-04-04 00:13:50 +00:00
|
|
|
|
2023-04-04 13:17:55 +00:00
|
|
|
build_docker:
|
|
|
|
@echo "Building Docker image..."
|
2023-04-06 09:47:30 +00:00
|
|
|
docker build -t $(BINARY_NAME):latest .
|
|
|
|
|
|
|
|
watch_frontend:
|
|
|
|
@echo "Building frontend assets..."
|
|
|
|
./node_modules/.bin/vite dev --port 16157
|
|
|
|
|
|
|
|
watch_backend:
|
|
|
|
@echo "Building Opengist binary..."
|
|
|
|
DEV=1 ./node_modules/.bin/nodemon --watch '**/*' -e html,yml,go,js --signal SIGTERM --exec 'go' run .
|
|
|
|
|
|
|
|
watch:
|
|
|
|
@bash ./watch.sh
|
2023-04-04 13:17:55 +00:00
|
|
|
|
2023-04-04 00:13:50 +00:00
|
|
|
clean:
|
|
|
|
@echo "Cleaning up build artifacts..."
|
|
|
|
@rm -f $(BINARY_NAME) public/manifest.json
|
2023-04-06 09:47:30 +00:00
|
|
|
@rm -rf public/assets
|
2023-04-04 00:13:50 +00:00
|
|
|
|
2023-04-04 13:17:55 +00:00
|
|
|
clean_docker:
|
|
|
|
@echo "Cleaning up Docker image..."
|
2023-04-06 09:47:30 +00:00
|
|
|
@docker rmi $(BINARY_NAME)
|