-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (60 loc) · 2.13 KB
/
Makefile
File metadata and controls
75 lines (60 loc) · 2.13 KB
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
COMPOSE_FILE=docker-compose.dev.yml
PROJECT_NAME=js2-gateway
IMAGE_NAME=ghcr.io/geochemical-modeling/js2-gateway
STACK_NAME=$(PROJECT_NAME)-stack
STACK_FILE=stack.yml
TAG=latest
.PHONY: up down restart logs frontend deploy build
## -----------------------------------------------
# Running app in dev + Debugging with logs and shell
## -----------------------------------------------
# Run the app in development env
up:
@echo "Building the project..."
@cd frontend && npm install && npm run build
@echo "Starting up the project with docker compose..."
@docker compose -f $(COMPOSE_FILE) -p $(PROJECT_NAME) up --build -d
# Shut down the development env
down:
@docker compose -f $(COMPOSE_FILE) -p $(PROJECT_NAME) down
# Restart the development env
restart: down up
# Quickly show the real-time logs for the dev environment;
logs:
@docker compose -f $(COMPOSE_FILE) -p $(PROJECT_NAME) logs -f
# For running execing into the dev container
shell:
@docker compose -f $(COMPOSE_FILE) exec web /bin/bash
# Run the react app only; good for when you just need to develop the frontend.
frontend:
@echo "Building the frontend..."
@cd frontend && npm install && npm run dev
## -----------------------------------------------
# Commands for starting up or shutting down prod
## -----------------------------------------------
build:
@echo "Building the project..."
@cd frontend && npm install && npm run build
@docker build -t $(IMAGE_NAME):$(TAG) .
# Expect a wait about 5 seconds for the replicas to be created after you run the command
deploy: build
docker stack deploy -c $(STACK_FILE) $(STACK_NAME)
# Remove stack
remove:
docker stack rm $(STACK_NAME)
# Redeploy the stack
redeploy: remove deploy
# View the logs of a service
# e.g. make stack-logs SERVICE=watchtower
stack-logs:
docker service logs -f $(STACK_NAME)_$(SERVICE)
## -----------------------------------------------
# Linting and Formatting
## -----------------------------------------------
format:
@cd backend && uv run ruff format .
@cd frontend && npm run format
# Checks for and fixes simple linting errors
lint:
@cd backend && uv run ruff check --fix .
@cd frontend && npm run lint