Replace source_host column with proper FK to domains table using composite key (domain_host, domain_tld). This enables JOIN queries instead of string concatenation for domain lookups. Changes: - Update Feed struct: SourceHost/TLD → DomainHost/DomainTLD - Update all SQL queries to use domain_host/domain_tld columns - Add column aliases (as source_host) for API backwards compatibility - Update trigram index from source_host to domain_host - Add getDomainHost() helper for extracting host from domain Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
38 lines
751 B
Docker
38 lines
751 B
Docker
FROM golang:latest AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y gcc && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy go mod files first for layer caching
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY *.go ./
|
|
COPY static/ ./static/
|
|
|
|
# Build the binary
|
|
RUN CGO_ENABLED=1 go build -o 1440.news .
|
|
|
|
# Runtime stage
|
|
FROM ubuntu:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update && apt-get install -y ca-certificates tzdata curl wget && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy binary from builder
|
|
COPY --from=builder /app/1440.news .
|
|
COPY --from=builder /app/static ./static
|
|
|
|
# Create feeds directory
|
|
RUN mkdir -p feeds
|
|
|
|
# Expose dashboard port
|
|
EXPOSE 4321
|
|
|
|
CMD ["./1440.news"]
|