# Single-stage build for Matterbridge with Kosmi bridge (Native WebSocket)
FROM golang:1.23-alpine

WORKDIR /app

# Install only essential dependencies
RUN apk add --no-cache ca-certificates

# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Build matterbridge
RUN go build -o matterbridge .

# Copy configuration
COPY matterbridge.toml /app/matterbridge.toml.example

# Run matterbridge
ENTRYPOINT ["/app/matterbridge"]
CMD ["-conf", "/app/matterbridge.toml"]
