-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (50 loc) · 2.23 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
FRONTEND_DIR="./driver-frontend"
BACKEND_DIR="./driver-backend"
DOCKERUSER=scusemua
# NOTE:
#
# If you're using Windows, then some of these commands may not work if you're using Windows PowerShell
# or Command Prompt. I recommend using a Unix shell, such as Git Bash, on Windows when building these targets.
# Copy the frontend 'dist' directory to the backend
copy-frontend:
@echo "Removing $(BACKEND_DIR)/dist directory (if it exists)..."
rm -rf $(BACKEND_DIR)/dist
@echo "Copying frontend dist to backend..."
cp -r $(FRONTEND_DIR)/dist $(BACKEND_DIR)/dist
# Build the frontend producing files that can be served statically by the backend
build-frontend:
@echo "Building frontend..."
cd $(FRONTEND_DIR) && npm run build
# Build the backend server for both Windows and Linux
build-backend-servers:
@echo "Building backend servers for both Windows and Linux"
make -C $(BACKEND_DIR) build-servers
# Build the backend server for Linux only
build-backend-linux:
@echo "Building backend servers for Linux only"
make -C $(BACKEND_DIR) build-server-linux
# Build the backend server for Windows only
build-backend-windows:
@echo "Building backend servers for Windows only"
make -C $(BACKEND_DIR) build-server
# Build the backend Docker image
build-backend-docker:
@echo "Building Docker image for backend..."
cd $(BACKEND_DIR) && docker build -t $(DOCKERUSER)/distributed-notebook-dashboard-backend .
# Push the latest backend docker image to Dockerhub
push-backend-docker:
@echo "Pushing Docker image for backend..."
docker push $(DOCKERUSER)/distributed-notebook-dashboard-backend:latest
# Target to build the frontend and the backend server in parallel
build-static-frontend-and-backend-servers:
make -j2 build-frontend build-backend-servers
# Run the backend in its Docker image
run-backend-docker:
# Using && instead of make -C on purpose or Windows breaks/doesn't load config correctly.
cd $(BACKEND_DIR) && make run-backend-docker
# Run the backend locally, not in a Docker image
run-backend-prebuilt:
# Using && instead of make -C on purpose or Windows breaks/doesn't load config correctly.
cd $(BACKEND_DIR) && run-server-prebuilt
# Default target
all: build-static-frontend-and-backend-servers copy-frontend build-backend-docker push-backend-docker