File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Stage 1: Modules caching
2
+ FROM golang:1.21 as modules
3
+ COPY go.mod go.sum /modules/
4
+ WORKDIR /modules
5
+ RUN go mod download
6
+
7
+ # Stage 2: Build
8
+ FROM golang:1.21 as builder
9
+ COPY --from=modules /go/pkg /go/pkg
10
+ COPY . /workdir
11
+ WORKDIR /workdir
12
+ # Install playwright cli with right version for later use
13
+ RUN PWGO_VER=$(grep -oE "playwright-go v\S+" /workdir/go.mod | sed 's/playwright-go //g') \
14
+ && go install github.com/playwright-community/playwright-go/cmd/playwright@${PWGO_VER}
15
+ # Build your app
16
+ RUN GOOS=linux GOARCH=amd64 go build -o /bin/myapp
17
+
18
+ # Stage 3: Final
19
+ FROM ubuntu:jammy
20
+ COPY --from=builder /go/bin/playwright /bin/myapp /
21
+ RUN apt-get update && apt-get install -y ca-certificates tzdata \
22
+ # Install dependencies and all browsers (or specify one)
23
+ && /playwright install --with-deps \
24
+ && rm -rf /var/lib/apt/lists/*
25
+ CMD ["/myapp"]
Original file line number Diff line number Diff line change @@ -103,6 +103,9 @@ func main() {
103
103
}
104
104
```
105
105
106
+ ## Docker
107
+ Refer to the [ Dockerfile.example] ( ./Dockerfile.example ) to build your own docker image.
108
+
106
109
## More examples
107
110
108
111
* Refer to [ helper_test.go] ( ./tests/helper_test.go ) for End-To-End testing
You can’t perform that action at this time.
0 commit comments