-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 836 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 836 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
# Stage 1: Build
FROM rust:alpine AS builder
RUN apk update && \
apk add --no-cache bash curl npm libc-dev binaryen clang openssl-dev openssl-libs-static pkgconfig
RUN cargo install dioxus-cli --locked
RUN rustup target add wasm32-unknown-unknown
WORKDIR /work
COPY . .
# Build Tailwind CSS
RUN npm install && npx @tailwindcss/cli -i tailwind.css -o assets/tailwind.css --minify
# Build fullstack app
RUN dx bundle --release --fullstack
# Stage 2: Runtime
FROM rust:alpine AS runner
RUN apk update && \
apk add --no-cache sed bash
# Rustfmt is needed for code formatting in sessions
RUN rustup component add rustfmt
WORKDIR /app
# Dioxus fullstack bundle output
COPY --from=builder /work/target/dx/tryrust/release/web /app
ENV RUST_LOG="info"
ENV IP="0.0.0.0"
ENV PORT="8080"
EXPOSE 8080
ENTRYPOINT ["/app/tryrust"]