playwright-go icon indicating copy to clipboard operation
playwright-go copied to clipboard

could not launch playwright when updating to v0.4101.0

Open abdelilahakebli opened this issue 1 year ago • 2 comments

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

abdelilahakebli avatar Jan 24 '24 15:01 abdelilahakebli

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

canstand avatar Jan 25 '24 03:01 canstand

is there any working Dockerfile example with alpine or ubuntu?

keremcankabadayi avatar Feb 15 '24 15:02 keremcankabadayi

same problem

dbelozerovx1 avatar Mar 11 '24 15:03 dbelozerovx1

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"]

canstand avatar Mar 11 '24 15:03 canstand

Take a look at https://github.com/playwright-community/playwright-go#docker

canstand avatar Mar 13 '24 12:03 canstand