spiegel-web/Dockerfile
2026-04-01 11:21:18 +02:00

34 lines
794 B
Docker

# Stage 1: Build
FROM rust:1.94-bookworm AS builder
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs
# Install wasm-pack
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# Add wasm target
RUN rustup target add wasm32-unknown-unknown
WORKDIR /app
# Cache npm dependencies
COPY package*.json ./
RUN npm ci
# Cache Rust dependencies
COPY image-processor/Cargo.toml image-processor/Cargo.lock* ./image-processor/
RUN mkdir -p image-processor/src && echo "pub fn main(){}" > image-processor/src/lib.rs \
&& cd image-processor && cargo fetch
# Copy full source and build
COPY . .
RUN npm run build
# Stage 2: Serve
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80