-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (66 loc) Β· 2.11 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Include variables
-include .env
export
# Variables
DOCKER_VERSION ?= latest
DOCKER_PLATFORM ?= linux/amd64
NODE_ENV ?= production
###################################################
# HELP ############################################
##################################################
all:
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n\nTargets:\n"}'
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# ################################################
# Development ####################################
# ################################################
.PHONY: install dev clean start strapi-build strapi-admin
install: ## Install all dependencies
npm ci
dev: ## Start Strapi for local development
NODE_ENV=development npm run develop
clean: ## Clean strapi files
rm -rf .cache
rm -rf build
start: ## Strapi start sequence (build + start)
$(MAKE) strapi-build
npm run start
strapi-build: ## Build Strapi CMS
npm run build
strapi-admin: ## Strapi GUI development
npx strapi develop --watch-admin
# ################################################
# Docker #########################################
# ################################################
.PHONY: docker-up
docker-up: ## Run docker containers
docker-compose up -d
.PHONY: docker-build
docker-build: ## Docker image build
docker buildx \
build \
--build-arg NODE_ENV=${NODE_ENV} \
--platform ${DOCKER_PLATFORM} \
-t ${DOCKER_IMAGE}:${DOCKER_VERSION} \
-f Dockerfile \
.
.PHONY: docker-push
docker-push: ## Push docker image to registry
docker push ${DOCKER_IMAGE}:${DOCKER_VERSION}
.PHONY: docker-dev
docker-dev: ## Run docker image
docker run \
-it \
--rm \
-p 1337:1337 \
-v $(CURDIR):/srv:cached \
${DOCKER_IMAGE}:${DOCKER_VERSION}
.PHONY: docker-mariadb
docker-mariadb: ## Run mariadb container
docker-compose up db
# ################################################
# Deploy #########################################
# ################################################
.PHONY: deploy
deploy: # Deploy to Fly.io
fly deploy