-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (21 loc) · 738 Bytes
/
Dockerfile
File metadata and controls
31 lines (21 loc) · 738 Bytes
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
FROM golang:1.26-alpine AS builder
WORKDIR /build
# Download dependencies first (cache layer)
COPY go.mod go.sum ./
RUN go mod download
# Build
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o cortex ./cmd/cortex
# Runtime image
FROM alpine:3.20
RUN apk add --no-cache ca-certificates curl \
&& addgroup -S cortex && adduser -S cortex -G cortex \
&& mkdir -p /home/cortex/.cortex && chown cortex:cortex /home/cortex/.cortex
COPY --from=builder /build/cortex /usr/local/bin/cortex
COPY --from=builder /build/migrations /migrations
USER cortex
EXPOSE 7438
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7438/health || exit 1
ENTRYPOINT ["cortex"]
CMD ["mcp"]