From e6bf8ffa689a1a00f2c4b0b9f9c5dd1ef029507c Mon Sep 17 00:00:00 2001 From: antifallobst Date: Wed, 4 Oct 2023 21:37:33 +0200 Subject: [PATCH] feat: dockerized project --- .dockerignore | 3 +++ Dockerfile | 24 ++++++++++++++++++++++++ nginx.conf | 8 ++++++++ 3 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..69adfab --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +dist +target +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a8c0698 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM rust:latest as build + +# Install trunk +RUN cargo install trunk + +# Install wasm target +RUN rustup target add wasm32-unknown-unknown + +RUN mkdir -p /frontend +WORKDIR /frontend + +COPY Cargo.lock Cargo.toml index.html ./ + +COPY src ./src +COPY style ./style + +# Build for release. +RUN trunk build --release + +FROM nginx:latest + +COPY ./nginx.conf /etc/nginx/conf.d/default.conf + +COPY --from=build /frontend/dist /usr/share/nginx/html diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..0319a8a --- /dev/null +++ b/nginx.conf @@ -0,0 +1,8 @@ +server { + listen 80; + server_name 0.0.0.0; + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file