-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (41 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
56 lines (41 loc) · 1.31 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Use the Rust builder image
FROM rust:slim-bookworm AS builder
# Set the working directory
WORKDIR /src
# Copy the local finalytics directory into the Docker image
COPY rust rust
# Copy the local web directory into the Docker image
COPY web web
# Install necessary dependencies for OpenSSL, nlopt, and build tools
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
cmake \
g++ \
perl \
cpanminus \
make \
curl
# Install libipc-cmd-perl
RUN cpanm IPC::Cmd
# Install Dioxus CLI and add wasm32-unknown-unknown target
RUN cargo install [email protected] --locked && rustup target add wasm32-unknown-unknown
# Change the working directory to the web directory
WORKDIR /src/web
# Build your Rust project with Dioxus CLI
RUN dx bundle --platform web
# Create the final runtime image
FROM debian:bookworm AS runner
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
openssl libssl3 ca-certificates
# Set the working directory to /web
WORKDIR /web
# Copy the application binary and frontend assets
COPY --from=builder /src/web/dist /web/dist
COPY --from=builder /src/web/target/release/finalytics-web /web/dist
# Set environment variable for production
ENV ENV=prod
EXPOSE 8080
# Define the command to run your application
CMD ["/web/dist/finalytics-web"]