-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (38 loc) · 1012 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ifneq (,$(wildcard ./.env))
include .env
export
endif
frontendLocation := ./frontend-bundle
distDir := ./dist
ifneq ($(ENVIRONMENT),PRODUCTION)
dev:
@echo "Starting frontend and backend in development mode..."
@npm run dev --prefix $(frontendLocation) & \
air . & \
wait
else
create_dist_dir:
@if [ ! -d "$(distDir)" ]; then \
echo "Creating $(distDir) directory..."; \
mkdir -p $(distDir); \
fi
copy_static_files: create_dist_dir
@echo "Copying static files..."
@if [ -f .env ]; then cp .env $(distDir)/; fi
@if [ -d static ]; then cp -R static $(distDir)/; fi
build: create_dist_dir copy_static_files
@echo "Building frontend and backend for production..."
@npm run build --prefix $(frontendLocation)
@go build -o $(distDir)/main
@echo "Build completed. Output is in $(distDir) directory."
endif
run-cli:
ifneq ($(ENVIRONMENT),PRODUCTION)
@make dev
else
@make build
@echo "Starting the application in production mode..."
@$(distDir)/main
endif
run-docker:
docker compose up