FROM golang:latest as builder
WORKDIR /crawler
COPY . ./
RUN go mod download && go mod tidy
RUN go build -o ./bin/crawler ./cmd/crawler

FROM golang:latest
#RUN go install github.com/playwright-community/playwright-go@latest
RUN go run github.com/playwright-community/playwright-go/cmd/playwright@v0.4001.0 install --with-deps
#RUN playwright install --with-deps
COPY --from=builder /crawler/bin/crawler /usr/bin/crawler
RUN mkdir /app
WORKDIR /app

ENTRYPOINT crawler
