Add Docker support and refactor data layer
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
FROM golang:1.24-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
|
||||
# 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 alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user