forked from h4ckf0r0day/obscura
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (41 loc) · 2.04 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (41 loc) · 2.04 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
FROM rust:1-slim-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
perl \
make \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Cache dependency compilation by copying manifests first
COPY Cargo.toml Cargo.lock ./
COPY crates/obscura-dom/Cargo.toml crates/obscura-dom/Cargo.toml
COPY crates/obscura-net/Cargo.toml crates/obscura-net/Cargo.toml
COPY crates/obscura-browser/Cargo.toml crates/obscura-browser/Cargo.toml
COPY crates/obscura-cdp/Cargo.toml crates/obscura-cdp/Cargo.toml
COPY crates/obscura-js/Cargo.toml crates/obscura-js/Cargo.toml
COPY crates/obscura-mcp/Cargo.toml crates/obscura-mcp/Cargo.toml
COPY crates/obscura-cli/Cargo.toml crates/obscura-cli/Cargo.toml
# Create stub src files so cargo can resolve the dependency graph
RUN for crate in obscura-dom obscura-net obscura-browser obscura-cdp obscura-js obscura-mcp; do \
mkdir -p crates/$crate/src && echo "// stub" > crates/$crate/src/lib.rs; \
done && \
mkdir -p crates/obscura-cli/src && \
echo "fn main() {}" > crates/obscura-cli/src/main.rs && \
echo "fn main() {}" > crates/obscura-cli/src/worker.rs
RUN cargo build --release --bin obscura --bin obscura-worker 2>/dev/null || true
ARG OBSCURA_VERSION
# Copy real sources and build
COPY crates/ crates/
RUN echo "Building Obscura version ${OBSCURA_VERSION:-from Cargo.toml}" && \
touch crates/*/src/*.rs && cargo build --release --bin obscura --bin obscura-worker
# ---
# distroless/cc: glibc + libgcc + CA certs only — no shell, no package manager
FROM gcr.io/distroless/cc-debian12
COPY --from=builder /build/target/release/obscura /obscura
COPY --from=builder /build/target/release/obscura-worker /obscura-worker
EXPOSE 9222
# Bind to 0.0.0.0 so the port is reachable via `docker run -p 9222:9222`.
# Native binary still defaults to 127.0.0.1 (loopback only) — this override
# is just for the container.
ENTRYPOINT ["/obscura"]
CMD ["serve", "--port", "9222", "--host", "0.0.0.0"]