cleanup file structure, dockerize app
This commit is contained in:
31
Makefile
31
Makefile
@@ -3,26 +3,41 @@
|
||||
help: ## This help dialog.
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 | "sort -u"}' $(MAKEFILE_LIST)
|
||||
|
||||
run: ## Start the application
|
||||
check-docker: ## Verify Docker CLI is available
|
||||
@command -v docker >/dev/null 2>&1 || { \
|
||||
echo "Error: docker not found."; \
|
||||
echo "Install Docker Desktop: https://docs.docker.com/desktop/setup/install/mac-install/"; \
|
||||
echo "Or run without Docker: make setup-local && make run-local"; \
|
||||
exit 1; \
|
||||
}
|
||||
|
||||
run: check-docker ## Start the application with Docker Compose
|
||||
docker compose up --build --remove-orphans
|
||||
|
||||
down: ## Stop the application
|
||||
run-local: ## Start the application locally (without Docker)
|
||||
go run ./cmd/app
|
||||
|
||||
down: check-docker ## Stop the application
|
||||
docker compose down --remove-orphans
|
||||
|
||||
setup-local: copy-config install-dependencies run ## Sets up your local environment
|
||||
setup-local: copy-config install-dependencies ## Install config and Go dependencies
|
||||
|
||||
setup-docker: setup-local run ## Install dependencies and start with Docker Compose
|
||||
|
||||
install-lint: ## Install Go lint
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
install-dependencies: ## Install go project dependencies
|
||||
install-dependencies: ## Install Go project dependencies
|
||||
go mod download
|
||||
go mod vendor
|
||||
|
||||
copy-config: ## Copy config file
|
||||
cp .env.dist .env
|
||||
copy-config: ## Copy config file if missing
|
||||
@test -f .env || cp .env.dist .env
|
||||
|
||||
lint: install-lint ## Run lint
|
||||
golangci-lint run
|
||||
|
||||
tests: down ## Run tests
|
||||
tests: ## Run tests
|
||||
go test -v ./...
|
||||
|
||||
build: ## Build the server binary
|
||||
go build -o bin/server ./cmd/app
|
||||
|
||||
Reference in New Issue
Block a user