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