Files
canon/Dockerfile
T
cdnutterandClaude Opus 5.5 b53faf58fd Send only the source to Docker builds
.dockerignore is now an allowlist (go.mod, go.sum, cmd, internal, web),
so data, backups, .env and anything a deploy tool keeps in the project
folder never go into the build context. A file changing or failing to
read while the context is sent cuts the upload short, which Docker
reports as "failed to read dockerfile: unexpected EOF". Also drops a
stray blank first line from the Dockerfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 13:57:36 -07:00

22 lines
674 B
Docker

FROM golang:1-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" -o /out/canon ./cmd/canon
FROM alpine:3
RUN apk add --no-cache ca-certificates tzdata \
&& adduser -D -u 1000 canon \
&& mkdir -p /data /backups && chown canon:canon /data /backups
COPY --from=build /out/canon /usr/local/bin/canon
USER canon
ENV CANON_DATA_DIR=/data \
CANON_PORT=4242
VOLUME /data /backups
EXPOSE 4242
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
CMD wget -qO- http://127.0.0.1:${CANON_PORT}/healthz >/dev/null || exit 1
ENTRYPOINT ["canon"]