-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 1.11 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (28 loc) · 1.11 KB
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
39
40
# ------- 1. CHEF STAGE ------- #
FROM messense/rust-musl-cross:x86_64-musl AS chef
RUN cargo install cargo-binstall --locked
RUN cargo binstall cargo-chef --no-confirm
RUN apt-get update && apt-get install -y libssl-dev pkg-config
RUN cargo install dioxus-cli --locked --target x86_64-unknown-linux-gnu
RUN rustup target add wasm32-unknown-unknown
ENV RUSTUP_TOOLCHAIN=stable
WORKDIR /app
# ------- 2. PLANNER STAGE ------- #
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# ------- 3. BUILDER STAGE ------- #
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
COPY . .
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-linux-musl-gcc
RUN dx build --release --fullstack
# ------- 4. CLEANER STAGE ------- #
FROM gcr.io/distroless/cc-debian12
COPY --from=builder --chmod=755 /app/target/dx/dioxus-ui/release/web/server /server
COPY --from=builder /app/target/dx/dioxus-ui/release/web/public /public
ENV IP=0.0.0.0
ENV PORT=8080
EXPOSE 8080
CMD ["/server"]