-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (28 loc) · 893 Bytes
/
Dockerfile
File metadata and controls
41 lines (28 loc) · 893 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
37
38
39
40
41
# Build stage
FROM rust:latest AS builder
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
# Install wasm-pack
RUN cargo install wasm-pack
# Add wasm target
RUN rustup target add wasm32-unknown-unknown
WORKDIR /app
# Copy dependency files first for better caching
COPY Cargo.toml Cargo.lock ./
COPY package.json ./
# Install npm dependencies
RUN npm install
# Copy source files
COPY src ./src
COPY index.html index.js webpack.config.js ./
# Build the project
RUN npm run build
# Production stage
FROM nginxinc/nginx-unprivileged:alpine
# Copy built files to nginx
COPY --from=builder /app/dist /usr/share/nginx/html
# Configure nginx to serve on port 8000 (default is 8080 for unprivileged)
RUN sed -i 's/listen\s*8080;/listen 8000;/g' /etc/nginx/conf.d/default.conf
EXPOSE 8000
CMD ["nginx", "-g", "daemon off;"]