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:
22
Dockerfile
Normal file
22
Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user