mirror of
https://github.com/geoffsee/predict-otron-9001.git
synced 2025-09-08 22:46:44 +00:00
Add Dockerfile for Leptos Chat deployment
This commit is contained in:
7
crates/leptos-chat/.dockerignore
Normal file
7
crates/leptos-chat/.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
||||
*
|
||||
!src/
|
||||
!style/
|
||||
!Cargo.toml/
|
||||
!index.html
|
||||
!Trunk.toml
|
||||
|
28
crates/leptos-chat/Dockerfile
Normal file
28
crates/leptos-chat/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
# Build stage
|
||||
FROM rust:1-alpine AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache npm nodejs musl-dev pkgconfig openssl-dev git curl bash
|
||||
|
||||
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy manifest first (cache deps)
|
||||
COPY . .
|
||||
# Install trunk
|
||||
RUN cargo install wasm-bindgen-cli
|
||||
|
||||
RUN cargo binstall trunk
|
||||
|
||||
# Build release artifacts
|
||||
RUN rustup target add wasm32-unknown-unknown && export RUSTFLAGS='--cfg getrandom_backend="wasm_js"' && trunk build --release
|
||||
|
||||
# Final stage: static web server
|
||||
FROM caddy:2-alpine
|
||||
|
||||
# Copy built assets into Caddy's web root
|
||||
COPY --from=builder /app/dist /usr/share/caddy
|
||||
|
||||
EXPOSE 8788
|
||||
CMD ["caddy", "file-server", "--root", "/usr/share/caddy", "--listen", ":8788"]
|
Reference in New Issue
Block a user