-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (52 loc) · 2.19 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (52 loc) · 2.19 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ---- GUI Builder ----
FROM node:22-bookworm-slim AS gui-builder
WORKDIR /build
# Build @inputlayer/api-client first (GUI depends on it at compile time)
COPY packages/api-client/package.json packages/api-client/package-lock.json ./packages/api-client/
RUN cd packages/api-client && npm ci --silent
COPY packages/api-client/src/ ./packages/api-client/src/
COPY packages/api-client/tsconfig.json ./packages/api-client/
RUN cd packages/api-client && npm run build
# Build GUI (Next.js static export)
COPY gui/package.json ./gui/
RUN cd gui && npm install --no-audit --no-fund --silent
COPY gui/ ./gui/
COPY docs/content/ ./docs/content/
RUN cd gui && npm run build
# ---- Rust Builder ----
FROM rust:1.88-bookworm AS builder
WORKDIR /build
# Cache dependencies: copy manifest first, build a dummy lib to cache deps
COPY Cargo.toml ./
RUN mkdir src && echo "fn main() {}" > src/main.rs && \
mkdir -p src/bin && echo "fn main() {}" > src/bin/server.rs && \
echo "" > src/lib.rs && \
cargo generate-lockfile && \
cargo build --release --bin inputlayer-server 2>/dev/null || true && \
rm -rf src
# Build the real binary
COPY src/ src/
COPY docs/ docs/
RUN cargo build --all-features --release --bin inputlayer-server && \
strip target/release/inputlayer-server
# ---- Runtime ----
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
RUN useradd -r -s /bin/false -m -d /var/lib/inputlayer inputlayer
COPY --from=builder /build/target/release/inputlayer-server /usr/local/bin/
COPY --chown=inputlayer:inputlayer --from=gui-builder /build/gui/dist/ /var/lib/inputlayer/gui/dist/
RUN mkdir -p /var/lib/inputlayer/data && \
chown -R inputlayer:inputlayer /var/lib/inputlayer
ENV INPUTLAYER_HTTP__HOST=0.0.0.0
ENV INPUTLAYER_HTTP__PORT=8080
ENV INPUTLAYER_STORAGE__DATA_DIR=/var/lib/inputlayer/data
ENV INPUTLAYER_STORAGE__AUTO_CREATE_KNOWLEDGE_GRAPHS=true
ENV INPUTLAYER_LOGGING__LEVEL=info
EXPOSE 8080
USER inputlayer
WORKDIR /var/lib/inputlayer
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
CMD curl -sf http://localhost:8080/health || exit 1
ENTRYPOINT ["inputlayer-server"]