-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (50 loc) · 1.56 KB
/
Dockerfile
File metadata and controls
66 lines (50 loc) · 1.56 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
# Multi-stage build for CLIAI
FROM rust:1.75-slim as builder
# Install system dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy dependency files
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src/ ./src/
# Build the application
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -r -s /bin/false cliai
# Copy binary from builder stage
COPY --from=builder /app/target/release/cliai /usr/local/bin/cliai
# Set permissions
RUN chmod +x /usr/local/bin/cliai
# Create config directory
RUN mkdir -p /home/cliai/.config/cliai && \
chown -R cliai:cliai /home/cliai
# Switch to non-root user
USER cliai
WORKDIR /home/cliai
# Set environment variables
ENV RUST_LOG=info
ENV CLIAI_CONFIG_DIR=/home/cliai/.config/cliai
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD cliai --version || exit 1
# Default command
ENTRYPOINT ["cliai"]
CMD ["--help"]
# Labels
LABEL org.opencontainers.image.title="CLIAI"
LABEL org.opencontainers.image.description="A powerful CLI assistant powered by local AI"
LABEL org.opencontainers.image.url="https://github.com/cliai/cliai"
LABEL org.opencontainers.image.source="https://github.com/cliai/cliai"
LABEL org.opencontainers.image.version="0.1.0"
LABEL org.opencontainers.image.licenses="MIT"