-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.wasm-frontend
More file actions
36 lines (27 loc) · 852 Bytes
/
Dockerfile.wasm-frontend
File metadata and controls
36 lines (27 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM rust:1-slim AS builder
RUN apt-get update && apt-get install -y \
curl \
git \
libssl-dev \
pkg-config \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install wasm-pack
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
WORKDIR /usr/src/nbody-wasm
COPY backend .
RUN cargo build --release
RUN cd nbody && wasm-pack build --target web
RUN cd wasm-bindings && wasm-pack build --target web
FROM node:alpine AS frontend
WORKDIR /usr/src/frontend
COPY frontend .
COPY --from=builder /usr/src/nbody-wasm/wasm-bindings/pkg/ /usr/src/backend/wasm-bindings/pkg/
ENV REACT_APP_WASM_BUILD=true
RUN npm install
RUN npm run build
FROM nginx:alpine
COPY --from=frontend /usr/src/frontend/build/ /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]