Files
spore-registry/Makefile
2025-10-27 15:18:55 +01:00

55 lines
1.0 KiB
Makefile

.PHONY: build run test clean docker-build docker-run docker-push
# Build the application
build:
go build -o spore-registry main.go
# Run the application
run:
go run main.go
# Run tests
test:
go test -v ./...
# Clean build artifacts
clean:
rm -f spore-registry
rm -rf registry/
# Run tests with coverage
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Format code
fmt:
go fmt ./...
# Lint code (requires golangci-lint)
lint:
golangci-lint run
# Install dependencies
deps:
go mod download
go mod tidy
# Docker variables
DOCKER_REGISTRY ?=
IMAGE_NAME = wirelos/spore-registry
IMAGE_TAG ?= latest
FULL_IMAGE_NAME = $(if $(DOCKER_REGISTRY),$(DOCKER_REGISTRY)/$(IMAGE_NAME),$(IMAGE_NAME)):$(IMAGE_TAG)
# Build Docker image
docker-build:
docker build -t $(FULL_IMAGE_NAME) .
# Run Docker container
docker-run:
docker run -p 8080:8080 -v registry-data:/data/registry --rm $(FULL_IMAGE_NAME)
# Push Docker image
docker-push:
docker push $(FULL_IMAGE_NAME)