amaniquery-agent / Dockerfile
Deployment
Automated deployment update
7661e86
Raw
History Blame Contribute Delete
1.44 kB
# Go Build Stage
FROM golang:1.24-alpine AS go-builder
WORKDIR /app
RUN apk add --no-cache git ca-certificates
COPY go.mod go.sum ./
COPY go.work go.work.sum ./
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /agent-server ./cmd/agent-server
# Rust Build Stage
FROM rust:1.83-alpine AS rust-builder
WORKDIR /app
RUN apk add --no-cache musl-dev
COPY rust-memory-service/Cargo.toml rust-memory-service/Cargo.lock ./
# Dummy build to cache deps
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN mkdir benches && echo "fn main() {}" > benches/memory_ops.rs
RUN cargo build --release
RUN rm -rf src
COPY rust-memory-service/ .
RUN cargo build --release
RUN cp target/release/memory-server /memory-server
# Runtime Stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
RUN adduser -D -g '' appuser
WORKDIR /app
# Copy binaries
COPY --from=go-builder /agent-server .
COPY --from=rust-builder /memory-server .
# Copy scripts and configs
COPY deployments/huggingface/start.sh .
COPY config.example.yaml ./config.yaml
COPY rust-memory-service/.env.example .env
RUN chmod +x start.sh && chown -R appuser:appuser /app
USER appuser
EXPOSE 7860
# Environment variables
ENV PORT=7860
ENV MEMORY_BIND_ADDR=127.0.0.1:9091
# Configure Go agent to use local memory service (needs env var mapping in config/env)
ENV MEMORY_SERVICE_HOST=127.0.0.1
ENV MEMORY_SERVICE_PORT=9091
CMD ["./start.sh"]