60 lines
817 B
Makefile
60 lines
817 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
|
|
|
|
format:
|
|
@ cargo fmt
|
|
.PHONY: format
|
|
|
|
|
|
# =====DATABASE STUFF=====
|
|
db:
|
|
@ docker run \
|
|
--rm \
|
|
-itd \
|
|
-v hilde_db-data:/var/lib/postgresql/data \
|
|
-e POSTGRES_USER=hilde \
|
|
-e POSTGRES_PASSWORD=hilde \
|
|
-e POSTGRES_DB=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 .
|
|
.PHONY: image
|