Added Makefile for setting up db
continuous-integration/drone the build was successful Details

pull/8/head
Jef Roosens 2021-06-25 12:48:45 +02:00
parent 89bc9b91e1
commit 68a19258d4
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
2 changed files with 54 additions and 1 deletions

2
.gitignore vendored
View File

@ -6,7 +6,7 @@ target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

53
Makefile 100644
View File

@ -0,0 +1,53 @@
# 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 .