From 2b1e350ce1327e635f75870bb61da24d20415369 Mon Sep 17 00:00:00 2001 From: Imbus Date: Tue, 17 Oct 2023 19:43:26 +0200 Subject: [PATCH] Justfile build and dev targets, working containerfile --- justfile | 21 +++++++++++++++++++++ server/.containerignore | 1 + server/Containerfile | 7 +++++++ server/src/main.rs | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 justfile create mode 100644 server/.containerignore create mode 100644 server/Containerfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..a7ddfc0 --- /dev/null +++ b/justfile @@ -0,0 +1,21 @@ +dev: + cd client && npm run dev + +build-client: + cd client && npm install + cd client && npm run build + +# npm run build places the build in the server/public directory +build-container: build-client + cd server && podman build -t server . + +start-release: build-container + podman run -d -p 8080:8080 --name frostbyte server + +clean: + podman container rm -f frostbyte + podman image rm -f server + rm -rf client/dist + rm -rf client/node_modules + rm -rf server/public + rm -rf server/target \ No newline at end of file diff --git a/server/.containerignore b/server/.containerignore new file mode 100644 index 0000000..1de5659 --- /dev/null +++ b/server/.containerignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/server/Containerfile b/server/Containerfile new file mode 100644 index 0000000..fb6ade3 --- /dev/null +++ b/server/Containerfile @@ -0,0 +1,7 @@ +FROM docker.io/rust:latest as builder +workdir /app +ADD . /app +RUN cargo clean +RUN cargo build --release +EXPOSE 8080 +CMD ["cargo", "run", "--release"] \ No newline at end of file diff --git a/server/src/main.rs b/server/src/main.rs index 7549bab..72a3898 100755 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -35,7 +35,7 @@ async fn main() -> std::io::Result<()> { ) .service(Files::new("/", "./public").index_file("index.html")) }) - .bind("localhost:8080")? + .bind("0.0.0.0:8080")? .run() .await }