# Build stage
FROM golang:1.26-alpine AS builder

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /memory-service ./cmd/

# Runtime stage
FROM alpine:3.21

RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /memory-service .

EXPOSE 8091

ENTRYPOINT ["./memory-service"]
