Files
ai/Dockerfile

43 lines
819 B
Docker

# Build stage
FROM golang:1.26-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git ca-certificates
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o lux-ai ./cmd/lux-ai
# Runtime stage
FROM alpine:3.19
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache ca-certificates tzdata
# Copy binary from builder
COPY --from=builder /app/lux-ai /usr/local/bin/lux-ai
# Create data directory
RUN mkdir -p /data
# Expose ports
EXPOSE 9090
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:9090/health || exit 1
# Run
ENTRYPOINT ["lux-ai"]
CMD ["-port", "9090", "-data", "/data"]