1- .PHONY : help db-start db-stop db-restart db-logs db-clean migrate-up migrate-down seed-data build run test clean docker-build docker-build-tag docker-push docker-build-push
1+ .PHONY : help db-start db-stop db-restart db-logs db-clean seed-data build run test clean docker-build docker-build-tag docker-push docker-build-push dev-sqlite dev-postgres
22
33# Default target
44help : # # Show this help message
55 @echo " Available commands:"
66 @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
77
8- # Database commands
8+ # Development environment setup
9+ dev-postgres : # # Run the application locally with database
10+ @echo " Setting up PostgreSQL development environment..."
11+ @cp .env.production .env 2> /dev/null || true
12+ @echo " Environment configured for PostgreSQL. Starting application..."
13+ @echo " Starting database and waiting for it to be ready..."
14+ make db-start
15+ @sleep 3
16+ go run ./cmd/api
17+
18+ # Database commands (PostgreSQL)
919db-start : # # Start PostgreSQL database container
1020 docker compose up -d postgres
1121
@@ -22,41 +32,40 @@ db-clean: ## Stop and remove PostgreSQL container and volumes
2232 docker compose down postgres
2333 docker volume rm commercify_postgres_data 2> /dev/null || true
2434
25- # Migration commands
26- migrate-up : # # Run database migrations up
27- docker compose run --rm migrate -up
28-
29- migrate-down : # # Run database migrations down
30- docker compose run --rm migrate -down
31-
32- migrate-status : # # Show migration status
33- docker compose run --rm migrate -status
34-
3535# Seed data
3636seed-data : # # Seed database with sample data
3737 docker compose run --rm seed -all
3838
3939# Application commands
4040build : # # Build the application
4141 go build -o bin/api ./cmd/api
42- go build -o bin/migrate ./cmd/migrate
4342 go build -o bin/seed ./cmd/seed
4443 go build -o bin/expire-checkouts ./cmd/expire-checkouts
4544
46- run : db-start # # Run the application locally with database
47- @echo " Starting database and waiting for it to be ready..."
48- @sleep 3
45+ run :
46+ @echo " Setting up SQLite development environment..."
47+ @cp .env.local .env 2> /dev/null || true
48+ @echo " Environment configured for SQLite. Starting application..."
4949 go run ./cmd/api
5050
51- run-docker : # # Run the entire application stack with Docker
51+ run-docker : # # Run the entire application stack with Docker (PostgreSQL)
5252 docker compose up -d
5353
54+ run-docker-sqlite : # # Run the application with Docker using SQLite
55+ docker compose -f docker-compose.local.yml up -d
56+
5457stop-docker : # # Stop the entire application stack
5558 docker compose down
5659
60+ stop-docker-sqlite : # # Stop the SQLite application stack
61+ docker compose -f docker-compose.local.yml down
62+
5763logs : # # Show application logs
5864 docker compose logs -f api
5965
66+ logs-sqlite : # # Show SQLite application logs
67+ docker compose -f docker-compose.local.yml logs -f api
68+
6069# Docker image commands
6170docker-build : # # Build Docker image
6271 docker build -t ghcr.io/zenfulcode/commercifygo:latest .
@@ -76,8 +85,9 @@ docker-push: ## Push Docker image to registry (use REGISTRY and TAG)
7685
7786docker-build-push : docker-build-tag docker-push # # Build and push Docker image (use REGISTRY and TAG)
7887
79- docker-dev-build : # # Build Docker image for development
80- docker build -t ghcr.io/zenfulcode/commercifygo:dev .
88+ docker-dev-push : # # Build Docker image for development
89+ docker build -t ghcr.io/zenfulcode/commercifygo:v2-dev .
90+ docker push ghcr.io/zenfulcode/commercifygo:v2-dev
8191
8292# Development commands
8393test : # # Run tests
@@ -90,12 +100,21 @@ clean: ## Clean build artifacts
90100 rm -rf bin/
91101 go clean
92102
93- # Database setup for development
94- dev-setup : db-start migrate-up seed-data # # Setup development environment (start db, migrate, seed)
95- @echo " Development environment ready!"
103+ # Database setup commands
104+ dev-setup : # # Setup development environment with PostgreSQL (start db, seed)
105+ make db-start
106+ @sleep 3
107+ make seed-data
108+ @echo " Development environment ready with PostgreSQL!"
109+
110+ dev-reset : db-clean db-start seed-data # # Reset PostgreSQL development environment
111+ @echo " Development environment reset with PostgreSQL!"
96112
97- dev-reset : db-clean db-start migrate-up seed-data # # Reset development environment
98- @echo " Development environment reset!"
113+ dev-reset-sqlite : # # Reset SQLite development environment
114+ @echo " Resetting SQLite development environment..."
115+ @rm -f commercify.db 2> /dev/null || true
116+ @cp .env.local .env 2> /dev/null || true
117+ @echo " SQLite database reset!"
99118
100119# Format and lint
101120fmt : # # Format Go code
0 commit comments