40 lines
899 B
Docker
40 lines
899 B
Docker
# Build stage
|
|
FROM golang:1.24-alpine AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git
|
|
|
|
WORKDIR /build
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy the entire monorepo
|
|
COPY . .
|
|
|
|
# Build the scraper-google service
|
|
WORKDIR /build/services/scraper-google
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o scraper-google .
|
|
|
|
# Runtime stage
|
|
FROM chromedp/headless-shell:latest
|
|
|
|
# Install ca-certificates for HTTPS requests
|
|
RUN apt-get update && apt-get install -y \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the binary from builder
|
|
COPY --from=builder /build/services/scraper-google/scraper-google .
|
|
|
|
# Copy environment files if they exist (optional)
|
|
COPY --from=builder /build/services/scraper-google/.env* ./
|
|
|
|
# Expose any ports if needed (not required for this service)
|
|
# EXPOSE 8080
|
|
|
|
# Run the scraper
|
|
CMD ["./scraper-google"]
|