Add build and run commands with Dockerfile

This commit is contained in:
dolphinau 2025-08-06 11:23:18 +02:00
parent c9a1c59eb4
commit 2e9b73a768
2 changed files with 34 additions and 4 deletions

7
Dockerfile Normal file
View 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"]

View file

@ -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