playwright-go
playwright-go copied to clipboard
could not launch playwright when updating to v0.4101.0
Could not launch playwright when updating to v0.4101.0 using docker
RUN go mod download
RUN go run github.com/playwright-community/playwright-go/cmd/playwright@latest install --with-deps
RUN make build
2024/01/24 15:46:34 could not launch playwright: could not start driver: fork/exec /root/.cache/ms-playwright-go/1.40.1/playwright.sh: no such file or directory
Rolling back to v0.4001.0 fixed the issue for me
RUN go mod download
RUN go run github.com/playwright-community/playwright-go/cmd/[email protected] install --with-deps
RUN make build
take a look go.mod, you need run go get -u github.com/playwright-community/playwright-go upgrade, not only install new driver and deps
is there any working Dockerfile example with alpine or ubuntu?
same problem
Look at the example below. Please make sure the playwright-go version in go.mod is the same as v0.4201.0 in the Dockerfile.
# Step 1: Modules caching
FROM golang:1.21 as modules
COPY go.mod go.sum /modules/
WORKDIR /modules
RUN go mod download
# Step 2: Build
FROM golang:1.21 as builder
COPY --from=modules /go/pkg /go/pkg
COPY . /app
WORKDIR /app
RUN go install github.com/playwright-community/playwright-go/cmd/[email protected]
RUN GOOS=linux GOARCH=amd64 \
go build -o /bin/app
# Step 3: Final
FROM ubuntu:jammy
COPY --from=builder /go/bin/playwright /playwright
COPY --from=builder /bin/app /app
RUN apt-get update && apt-get install -y ca-certificates tzdata \
&& /playwright install --with-deps chromium \
&& rm -rf /var/lib/apt/lists/*
CMD ["/app"]
Take a look at https://github.com/playwright-community/playwright-go#docker