Spaces:
Runtime error
Runtime error
alamin655
commited on
Commit
•
a115724
1
Parent(s):
b5f7a37
Create Dockerfile
Browse files- Dockerfile +28 -0
Dockerfile
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM rust:latest AS chef
|
2 |
+
# We only pay the installation cost once,
|
3 |
+
# it will be cached from the second build onwards
|
4 |
+
RUN cargo install cargo-chef --locked
|
5 |
+
|
6 |
+
WORKDIR /app
|
7 |
+
|
8 |
+
FROM chef AS planner
|
9 |
+
COPY . .
|
10 |
+
RUN cargo chef prepare --recipe-path recipe.json
|
11 |
+
|
12 |
+
FROM chef AS builder
|
13 |
+
COPY --from=planner /app/recipe.json recipe.json
|
14 |
+
# Build dependencies - this is the caching Docker layer!
|
15 |
+
RUN cargo chef cook --release --recipe-path recipe.json
|
16 |
+
|
17 |
+
# Build application
|
18 |
+
COPY . .
|
19 |
+
RUN cargo install --path .
|
20 |
+
|
21 |
+
# We do not need the Rust toolchain to run the binary!
|
22 |
+
FROM gcr.io/distroless/cc-debian12
|
23 |
+
COPY --from=builder /app/public/ /opt/websurfx/public/
|
24 |
+
COPY --from=builder /app/websurfx/config.lua /etc/xdg/websurfx/config.lua
|
25 |
+
COPY --from=builder /app/websurfx/allowlist.txt /etc/xdg/websurfx/allowlist.txt
|
26 |
+
COPY --from=builder /app/websurfx/blocklist.txt /etc/xdg/websurfx/blocklist.txt
|
27 |
+
COPY --from=builder /usr/local/cargo/bin/* /usr/local/bin/
|
28 |
+
CMD ["websurfx"]
|