From 4bc6165258cd7b5b76ccb01aa75c7cefdc35d143 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 17 Jan 2026 23:17:49 -0800 Subject: feat: Initial commit --- Dockerfile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Dockerfile (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bce712d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +# Build stage +FROM golang:1.22-alpine AS builder + +WORKDIR /app + +# Install build dependencies +RUN apk add --no-cache git + +# Copy go mod files +COPY go.mod go.sum ./ +RUN go mod download + +# Copy source code +COPY . . + +# Build the binary +RUN CGO_ENABLED=0 GOOS=linux go build \ + -ldflags="-s -w -X main.version=$(git describe --tags --always --dirty 2>/dev/null || echo dev)" \ + -o kaze ./cmd/kaze + +# Runtime stage +FROM alpine:3.19 + +WORKDIR /app + +# Install CA certificates for HTTPS requests +RUN apk add --no-cache ca-certificates tzdata + +# Create non-root user +RUN adduser -D -u 1000 kaze +USER kaze + +# Copy binary from builder +COPY --from=builder /app/kaze . + +# Create data directory +RUN mkdir -p /app/data + +# Expose port +EXPOSE 8080 + +# Default config location +ENV KAZE_CONFIG=/app/config.yaml + +# Health check +HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1 + +# Run the application +ENTRYPOINT ["./kaze"] +CMD ["--config", "/app/config.yaml"] -- cgit v1.2.3