Added Makefile for setting up db
continuous-integration/drone the build was successful
Details
continuous-integration/drone the build was successful
Details
parent
89bc9b91e1
commit
68a19258d4
|
@ -6,7 +6,7 @@ target/
|
||||||
|
|
||||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
# 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
|
# 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
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
|
@ -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 .
|
Reference in New Issue