-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
34 lines (26 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
# ── Build stage ────────────────────────────────────────────────────────────────
FROM rust:1.88-bookworm AS builder
WORKDIR /workspace
# Cache dependency build: copy manifests first, create dummy src, build deps.
COPY Cargo.toml Cargo.lock ./
RUN mkdir -p src/bin && \
echo 'fn main() {}' > src/bin/crdgen.rs && \
echo 'fn main() {}' > src/main.rs && \
echo '' > src/lib.rs && \
cargo build --release 2>/dev/null || true && \
rm -rf src \
target/release/deps/odoo_operator* target/release/deps/libodoo_operator* \
target/release/odoo-operator target/release/odoo_operator* \
target/release/.fingerprint/odoo-operator-*
# Copy real source + scripts.
COPY src/ src/
COPY scripts/ scripts/
COPY tests/ tests/
# Build the operator binary.
RUN cargo build --release --bin odoo-operator
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM gcr.io/distroless/cc-debian12:nonroot
WORKDIR /
COPY --from=builder /workspace/target/release/odoo-operator /manager
USER 65532:65532
ENTRYPOINT ["/manager"]