- Create Dockerfile for server with multi-stage build - Create Dockerfile for agent with multi-stage build - Set up Gitea Actions workflow to automatically build and release binaries - Build for all platforms: Linux (amd64/arm64), macOS (amd64/arm64), Windows (amd64) - Generate checksums for all release artifacts - Include Docker image building in CI/CD pipeline - Add release upload script for manual Gitea releases - Add comprehensive RELEASE.md documentation
49 lines
1.0 KiB
Docker
49 lines
1.0 KiB
Docker
# Multi-stage build for nerd-monitor server
|
|
FROM golang:1.24.4-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git make
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Generate templ templates
|
|
RUN go run github.com/a-h/templ/cmd/templ@latest generate
|
|
|
|
# Build the server binary
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o nerd-monitor-server ./cmd/server
|
|
|
|
# Runtime stage
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# Install ca-certificates for HTTPS
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
# Copy binary from builder
|
|
COPY --from=builder /app/nerd-monitor-server .
|
|
|
|
# Create non-root user
|
|
RUN addgroup -D appgroup && adduser -D appuser -G appgroup
|
|
USER appuser
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --quiet --tries=1 --spider http://localhost:8080/login || exit 1
|
|
|
|
# Run the server
|
|
ENTRYPOINT ["./nerd-monitor-server"]
|
|
CMD ["-addr", "0.0.0.0", "-port", "8080"]
|