Add build and run commands with Dockerfile
This commit is contained in:
parent
c9a1c59eb4
commit
2e9b73a768
2 changed files with 34 additions and 4 deletions
7
Dockerfile
Normal file
7
Dockerfile
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
FROM rust:1.88
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN cargo build --release
|
||||||
|
CMD ["./target/release/lwn-sub-snoozer", "/rss/lwn-sub.xml"]
|
||||||
31
justfile
31
justfile
|
|
@ -1,7 +1,30 @@
|
||||||
|
set dotenv-load
|
||||||
|
|
||||||
|
POSTGRES_HOST := 'lwn-sub-snoozer_db'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf target
|
rm -rf target
|
||||||
podman network rm lwn-sub-snoozer || true
|
podman network rm lwn-sub-snoozer_network || true
|
||||||
|
|
||||||
db:
|
init_db:
|
||||||
podman network create lwn-sub-snoozer || true
|
podman network create lwn-sub-snoozer_network || true
|
||||||
podman run --name postgres --rm -p 5432:5432 --network=lwn-sub-snoozer -e POSTGRES_DB=dev -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root docker.io/postgres:alpine
|
podman run --rm -d --replace \
|
||||||
|
--name {{POSTGRES_HOST}} \
|
||||||
|
--network=lwn-sub-snoozer_network \
|
||||||
|
-p 5432:5432 \
|
||||||
|
--env-file .env \
|
||||||
|
docker.io/postgres:alpine
|
||||||
|
|
||||||
|
init_app:
|
||||||
|
podman build --tag lwn-sub-snoozer_app:latest .
|
||||||
|
|
||||||
|
init: init_db init_app
|
||||||
|
|
||||||
|
run:
|
||||||
|
podman run --rm \
|
||||||
|
--name lwn-sub-snoozer_app \
|
||||||
|
--network lwn-sub-snoozer_network \
|
||||||
|
-e POSTGRES_HOST={{POSTGRES_HOST}} \
|
||||||
|
--env-file .env \
|
||||||
|
--volume /tmp/lwn_sub:/rss \
|
||||||
|
lwn-sub-snoozer_app:latest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue