-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (66 loc) · 2.37 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
include .env
##############################
# CONDITIONAL STATEMENTS
##############################
# Replace all " to empty to remove it using subst
wpCustomThemeDir = $(subst ",,${CUSTOM_THEME_DIR})
wpCustomThemeSrcDir = $(subst ",,${CUSTOM_THEME_SRC_DIR})
wpCustomThemeSrcJsDir = $(subst ",,${CUSTOM_THEME_SRC_JS_DIR})
wpCustomThemeSrcSassDir = $(subst ",,${CUSTOM_THEME_SRC_SASS_DIR})
srcDirs = $(wpCustomThemeDir) $(wpCustomThemeSrcDir) $(wpCustomThemeSrcJsDir) $(wpCustomThemeSrcSassDir)
wpCustomThemeJsFiles = $(subst ",,${CUSTOM_THEME_SRC_JS_FILES})
wpCustomThemeSassFiles = $(subst ",,${CUSTOM_THEME_SRC_SASS_FILES})
# Loop all js files then assign it with the js source path directory
jsFiles := $(foreach jsFile,$(wpCustomThemeJsFiles),$(wpCustomThemeSrcJsDir)/$(jsFile))
# Loop all js files then assign it with the js source path directory
sassFiles := $(foreach sassFile,$(wpCustomThemeSassFiles),$(wpCustomThemeSrcSassDir)/$(sassFile))
#################
# COMMANDS
#################
# Start the wordpress website
start:
docker-compose up -d
# Restart the container
restart: down start
# Build and start the wordpress website
build:
docker-compose up -d --build
# Run healthcheck
healthcheck:
docker-compose run --rm healthcheck
# Stop current running containers
down:
docker-compose down
# Run the build & healthcheck
install: build healthcheck
# Build and start the wordpress website using wpcli configurations
configure:
docker-compose -f docker-compose.yml -f wp-auto-config.yml run --rm wp-auto-config
# Build and start the wordpress website using wpcli configurations
autoinstall: build
@echo "⚙️ Installing wordpress using wpcli..."
docker-compose -f docker-compose.yml -f wp-auto-config.yml run --rm wp-auto-config
# Clean/Delete all installed wordpress & database setup
clean: down
@echo "💥 Removing related folders/files..."
@rm -rf mysql/* wordpress/* wordpress/.htaccess
@echo "\n⚙️ Related folders/files has been removed..."
# Run wpcli in the terminal
run-wpcli:
docker-compose run --rm wpcli bash
# Remove all stopped containers
remove-containers:
docker rm -f $(docker ps -aq)
# Generate source files for custom theme
gen-src:
@echo -e "⚙️ Generating source files...\n"
ifdef srcDirs
@mkdir -pv $(srcDirs)
endif
ifdef jsFiles
touch $(jsFiles)
endif
ifdef sassFiles
touch $(sassFiles)
endif
@echo -e "\n⚙️ Source files have been generated..."