-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile.demo
47 lines (35 loc) · 1.24 KB
/
Dockerfile.demo
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
# Use the official Rust image as the base image for the builder stage
FROM rust:latest as builder
# Install cargo-binstall
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
# Install trunk
RUN cargo binstall trunk -y
RUN rustup target add wasm32-unknown-unknown
# Set the working directory
WORKDIR /usr/src/app
# Copy the actual source code
COPY Cargo.toml Cargo.lock ./
COPY taxy taxy
COPY taxy-api taxy-api
COPY taxy-webui taxy-webui
# Build the web UI
WORKDIR /usr/src/app/taxy-webui
RUN trunk build --cargo-profile web-release --release
WORKDIR /usr/src/app
# Build the Rust project
RUN cargo build --all-features --release
# Prepare the final image
FROM debian:bookworm-slim as runtime
# Install dependencies for the Rust binary
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the Rust binary from the builder stage
COPY --from=builder /usr/src/app/target/release/taxy /usr/bin
# Add admin user
RUN taxy add-user admin -p admin
# Set the entrypoint to run the Rust binary
ENTRYPOINT ["taxy", "start", "--webui", "0.0.0.0:8080"]