Makefile
1.32 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
.PHONY: start wasm build run clean
PROFILE ?= dev
ifeq "$(PROFILE)" "release"
CARGO_PROFILE = --release
WASM_PROFILE = --release
WASM_EXTRA = --no-default-features --features wee_alloc
else
CARGO_PROFILE =
WASM_PROFILE = --dev
WASM_EXTRA =
endif
define msg
@printf "\033[38;5;197m%s\033[0m\n" "$(1)"
endef
start:
systemfd --no-pid -s 0.0.0.0:3000 -- \
cargo watch -i static/ -i var/ -s "PROFILE=$(PROFILE) make run"
wasm:
$(call msg,BUILD WASM UI)
@PROFILE=$(PROFILE) wasm-pack build $(WASM_PROFILE) -d ../static/ui \
-t web ./ui -- $(WASM_EXTRA)
build:
$(call msg,BUILD SERVER)
@PROFILE=$(PROFILE) cargo build $(CARGO_PROFILE) --bin artshop-server
run: build wasm
$(call msg,RUN SERVER)
@PROFILE=$(PROFILE) cargo run $(CARGO_PROFILE) --bin artshop-server
release:
docker build -t artshop -f build/Dockerfile .
devdb:
docker network create mariadb-dev-network
docker run --detach --network mariadb-dev-network --name mariadb-dev \
-p 3306:3306 \
--env MARIADB_USER=artshop \
--env MARIADB_PASSWORD=123456 \
--env MARIADB_ROOT_PASSWORD=123456 mariadb:latest
enterdb:
docker exec -it mariadb-dev mysql -D artshop -u artshop -p
# docker run -it --network mariadb-dev-network --rm mariadb:latest \
# mysql -h mariadb-dev -u artshop -p
rootdb:
docker exec -it mariadb-dev mysql -p
clean:
cargo clean
rm -Rf ./static/ui