-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (29 loc) · 998 Bytes
/
Copy pathDockerfile
File metadata and controls
38 lines (29 loc) · 998 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 rustlang/rust:nightly-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 --version 0.7.3
RUN rustup target add wasm32-unknown-unknown
WORKDIR /work
COPY . .
RUN npm install
RUN dx bundle --web --release && \
if [ -x /work/target/dx/blog/release/web/blog ]; then \
:; \
elif [ -x /work/target/dx/blog/release/web/server ]; then \
cp /work/target/dx/blog/release/web/server /work/target/dx/blog/release/web/blog; \
else \
echo "Bundled server binary not found" >&2; \
ls -la /work/target/dx/blog/release/web >&2; \
exit 1; \
fi
# Stage 2: Runtime
FROM rustlang/rust:nightly-alpine AS runner
WORKDIR /app
# Dioxus fullstack bundle output
COPY --from=builder /work/target/dx/blog/release/web /app
ENV RUST_LOG="info"
ENV IP="0.0.0.0"
ENV PORT="8080"
EXPOSE 8080
ENTRYPOINT ["/app/blog"]