- Create Dockerfile for webhook (Go application) - Add CloudronManifest.json with basic configuration - Include README.md with usage documentation - Add hooks.json.example configuration template - Add logo.png (256x256) - Add CHANGELOG.md for version tracking Webhook is a lightweight configurable tool written in Go that allows creating HTTP endpoints (hooks) on your server for executing configured commands. Package includes: - Multi-stage Dockerfile using golang:1.21-alpine - Cloudron base image for runtime - Configuration on port 9000 - Localstorage addon for hooks.json - 256MB memory limit 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
41 lines
743 B
Docker
41 lines
743 B
Docker
FROM golang:1.21-alpine AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git make
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY repo/go.mod repo/go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY repo/ .
|
|
|
|
# Build application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o webhook
|
|
|
|
# Final stage
|
|
FROM cloudron/base:3.2.0
|
|
|
|
# Copy binary from builder
|
|
COPY --from=builder /app/webhook /usr/local/bin/webhook
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /app/data
|
|
|
|
# Set permissions
|
|
RUN chmod +x /usr/local/bin/webhook
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Expose port
|
|
EXPOSE 9000
|
|
|
|
# Start application
|
|
CMD ["/usr/local/bin/webhook", "-hooks", "/app/data/hooks.json", "-verbose"]
|