|
| 1 | +# Build context is the repo root |
| 2 | +# Deploy: git archive --format=tar.gz -o /tmp/deploy.tar.gz HEAD |
| 3 | + |
| 4 | +# Stage 1: Build all Rust artifacts (WASM + backend binary) |
| 5 | +FROM rust:1.88-bookworm AS rust-builder |
| 6 | +RUN cargo install wasm-pack --locked |
| 7 | +WORKDIR /app |
| 8 | +COPY playground/Cargo.toml playground/Cargo.lock ./ |
| 9 | +COPY playground/wasm/ wasm/ |
| 10 | +COPY playground/backend/ backend/ |
| 11 | +RUN cd wasm && wasm-pack build --target web --release --out-dir /app/wasm-pkg |
| 12 | +RUN cargo build --release -p solscript-playground |
| 13 | + |
| 14 | +# Stage 2: Build Vue frontend |
| 15 | +FROM node:20-alpine AS frontend-builder |
| 16 | +WORKDIR /app |
| 17 | +COPY playground/frontend/package*.json ./ |
| 18 | +RUN npm ci |
| 19 | +COPY playground/frontend/ ./ |
| 20 | +COPY --from=rust-builder /app/wasm-pkg/ ./src/wasm-pkg/ |
| 21 | +RUN npm run build |
| 22 | + |
| 23 | +# Stage 3: Build Astro site |
| 24 | +FROM node:20-alpine AS astro-builder |
| 25 | +WORKDIR /app |
| 26 | +COPY website/package*.json ./ |
| 27 | +RUN npm ci |
| 28 | +COPY website/ ./ |
| 29 | +RUN npm run build |
| 30 | + |
| 31 | +# Stage 4: Runtime (lean — no Solana toolchain yet) |
| 32 | +FROM debian:bookworm-slim |
| 33 | +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* |
| 34 | +COPY --from=rust-builder /app/target/release/solscript-playground /usr/local/bin/ |
| 35 | +COPY --from=frontend-builder /app/dist/ /app/playground/ |
| 36 | +COPY --from=astro-builder /app/dist/ /app/astro/ |
| 37 | + |
| 38 | +ENV PLAYGROUND_DIR=/app/playground |
| 39 | +ENV ASTRO_DIR=/app/astro |
| 40 | +ENV PORT=3000 |
| 41 | +ENV RUST_LOG=info |
| 42 | +EXPOSE 3000 |
| 43 | +CMD ["solscript-playground"] |
0 commit comments