-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (37 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
51 lines (37 loc) · 1.1 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
# Multi-stage build for Universal AI Governor
FROM rust:1.80 as rust-builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src/ ./src/
COPY benches/ ./benches/
# Build the Rust application
RUN cargo build --release
# Go builder stage
FROM golang:1.23 as go-builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
COPY cmd/ ./cmd/
COPY pkg/ ./pkg/
COPY internal/ ./internal/
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux go build -o universal-ai-governor-go .
# Final runtime image
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy binaries from builders
COPY --from=rust-builder /app/target/release/universal-ai-governor /usr/local/bin/
COPY --from=go-builder /app/universal-ai-governor-go /usr/local/bin/
# Copy configuration files
COPY config/ ./config/
# Create non-root user
RUN useradd -r -s /bin/false governor
USER governor
EXPOSE 8080
# Default to running the Rust version
CMD ["universal-ai-governor", "--config", "config/production.toml"]