-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
23 lines (22 loc) · 946 Bytes
/
Copy pathDockerfile
File metadata and controls
23 lines (22 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# smolanalytics — single static binary on distroless. No cgo, no cluster.
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
ARG VERSION=docker
RUN CGO_ENABLED=0 go build -trimpath \
-ldflags "-s -w -X github.com/Arjun0606/smolanalytics/internal/api.Version=${VERSION}" \
-o /smolanalytics ./cmd/smolanalytics
FROM gcr.io/distroless/static-debian12
LABEL io.modelcontextprotocol.server.name="io.github.Arjun0606/smolanalytics"
COPY --from=build /smolanalytics /smolanalytics
# containers must bind the wildcard for `-p` port mapping to work. `serve` on a public
# bind requires a password (set SMOLANALYTICS_PASSWORD); `demo` is exempt (throwaway data).
ENV ADDR=0.0.0.0:8080 SMOLANALYTICS_DB=/data/smolanalytics.data
VOLUME /data
EXPOSE 8080
# ENTRYPOINT is just the binary so `docker run <img> demo|serve|mcp` works;
# CMD defaults to serve.
ENTRYPOINT ["/smolanalytics"]
CMD ["serve"]