Files
Paul TalandClaude Opus 5.5 f8e851fdb9 Add Docker deployment with deploy.sh
- Dockerfile: static build on alpine, runs as non-root, data on /data
  volume, health check on /healthz
- deploy.sh: builds the image and (re)starts a detached container with
  restart policy, .env as env file and the pocketkv-data volume
- .env.example: PORT for the host port; go-run-only settings commented out
- README: Docker deployment, updates, backups and HTTPS via Caddy

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-22 22:30:29 +02:00

16 lines
570 B
Docker

FROM golang:1.25-alpine AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /pocketkv ./cmd/pocketkv
FROM alpine:3.22
RUN adduser -D -H -u 10001 pocketkv && mkdir /data && chown pocketkv:pocketkv /data
COPY --from=build /pocketkv /usr/local/bin/pocketkv
# Fixed inside the container: listen on 8080, keep data on the /data volume.
ENV ADDR=:8080 DATA_FILE=/data/pocketkv.json
USER pocketkv
VOLUME /data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1:8080/healthz || exit 1
ENTRYPOINT ["pocketkv"]