54 lines
741 B
Makefile
54 lines
741 B
Makefile
# The main usecase for this Makefile is to simplify database management
|
|
|
|
|
|
all: build
|
|
.PHONY: all
|
|
|
|
|
|
# =====CARGO STUFF=====
|
|
build:
|
|
@ cargo build
|
|
.PHONY: build
|
|
|
|
run:
|
|
@ cargo run
|
|
.PHONY: run
|
|
|
|
test:
|
|
@ cargo test
|
|
.PHONY: test
|
|
|
|
lint:
|
|
@ cargo fmt -- --check
|
|
@ cargo clippy --all-targets -- -D warnings
|
|
.PHONY: lint
|
|
|
|
|
|
# =====DATABASE STUFF=====
|
|
db:
|
|
@ docker run \
|
|
--rm \
|
|
-itd \
|
|
-v hilde_db-data:/var/lib/postgresql/data \
|
|
-e POSTGRES_USER=hilde \
|
|
-e POSTGRES_PASSWORD=hilde \
|
|
--name hilde_db \
|
|
-p 5432:5432 \
|
|
postgres:13-alpine
|
|
.PHONY: db
|
|
|
|
psql:
|
|
@ docker exec \
|
|
-it hilde_db \
|
|
psql -U hilde
|
|
.PHONY: psql
|
|
|
|
stop-db:
|
|
@ docker stop hilde_db
|
|
.PHONY: stop-db
|
|
|
|
|
|
# =====DOCKER STUFF=====
|
|
image:
|
|
@ docker build -t hilde:latest .
|