FROM golang:1.24-alpine AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /scrawl .

FROM alpine:3.20
RUN apk add --no-cache ca-certificates
COPY --from=build /scrawl /usr/local/bin/scrawl
# Host key persists in a volume — see docker-compose.yml — so it doesn't
# regenerate (and change the server's fingerprint) on every redeploy.
ENV HOST_KEY_PATH=/data/host_key
EXPOSE 23235
CMD ["scrawl"]
