-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (48 loc) · 1.59 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (48 loc) · 1.59 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
# SmartAssist Multi-Stage Dockerfile
# Builds the `smartassist` CLI binary and provides a minimal runtime image.
#
# Build:
# docker build -t smartassist:latest .
#
# Run gateway:
# docker run --rm -p 18789:18789 smartassist:latest gateway
#
# Run cron:
# docker run --rm smartassist:latest cron
#
# Run doctor:
# docker run --rm smartassist:latest doctor --full
# ---------------------------------------------------------------------------
# Builder stage
# ---------------------------------------------------------------------------
FROM rust:1.75-bookworm AS builder
WORKDIR /build
# Install system dependencies required by native crates
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
# Copy full source tree
COPY . .
# Build the CLI binary in release mode
RUN cargo build --release --bin smartassist
# ---------------------------------------------------------------------------
# Runtime stage
# ---------------------------------------------------------------------------
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 smartassist
WORKDIR /app
COPY --from=builder /build/target/release/smartassist /usr/local/bin/smartassist
USER smartassist
# Default health check (override in compose per service)
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD smartassist doctor || exit 1
ENTRYPOINT ["smartassist"]
CMD ["--help"]