fork/chhoto-url

git clone https://git.julia.blue/fork/chhoto-url

SinTan1729chg: Shipping location of the binary is now /app/chhoto-url inside container7f1745b

unicode
1.1 KiB34 linesraw
1# SPDX-FileCopyrightText: 2023-2026 Sayantan Santra <sayantan.santra689@gmail.com>
2# SPDX-License-Identifier: MIT
3
4FROM docker.io/lukemathwalker/cargo-chef:latest-rust-slim AS chef
5WORKDIR /chhoto-url
6
7FROM chef AS planner
8COPY ./backend/Cargo.toml ./backend/Cargo.lock ./
9COPY ./backend/src ./src
10RUN cargo chef prepare --recipe-path recipe.json
11
12FROM chef AS builder
13ARG target=x86_64-unknown-linux-musl
14RUN apt-get update && apt-get install -y musl-tools
15RUN rustup target add $target
16
17COPY --from=planner /chhoto-url/recipe.json recipe.json
18# Build dependencies - this is the caching Docker layer
19RUN cargo chef cook --release --target=$target --recipe-path recipe.json
20
21COPY ./backend/Cargo.toml ./backend/Cargo.lock ./
22COPY ./backend/src ./src
23# Build application
24RUN cargo build --release --target=$target --locked --bin chhoto-url
25RUN cp /chhoto-url/target/$target/release/chhoto-url /chhoto-url/release
26RUN mkdir -p /frontend-final
27
28FROM scratch
29COPY --from=builder /chhoto-url/release /app/chhoto-url
30COPY ./frontend /app/frontend/base
31COPY --from=builder /frontend-final /frontend/final
32
33WORKDIR /app
34ENTRYPOINT ["/app/chhoto-url"]