Add Dockerfile and .dockerignore

Multi-stage build: golang:1.24-alpine builder, alpine:3.21 runtime.
Verified locally: all fx modules instantiate, migrations run,
healthcheck responds at /.well-known/healthcheck.json.
This commit is contained in:
clawbot
2026-02-09 12:36:55 -08:00
parent 18e7218d9e
commit 03cbc3cd1a
2 changed files with 30 additions and 0 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
bin/
chatd
data.db
.env
.git
*.test
*.out
debug.log

22
Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
RUN go build -ldflags "-X main.Version=${VERSION}" -o /chatd ./cmd/chatd
FROM alpine:3.21
RUN apk add --no-cache ca-certificates
COPY --from=builder /chatd /usr/local/bin/chatd
WORKDIR /data
EXPOSE 8080
ENTRYPOINT ["chatd"]