Download browser during docker build
All checks were successful
Build / build (push) Successful in 2m52s
All checks were successful
Build / build (push) Successful in 2m52s
Closes #1
This commit is contained in:
parent
97e7a8b8fc
commit
acc5bcdcfc
@ -15,4 +15,5 @@ COPY migrations ./migrations
|
||||
COPY *.go ./
|
||||
RUN go build -o /vivaplusdl
|
||||
|
||||
CMD ["/vivaplusdl"]
|
||||
RUN /vivaplusdl --install
|
||||
CMD ["/vivaplusdl", "--no-install"]
|
||||
|
18
main.go
18
main.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"flag"
|
||||
"github.com/playwright-community/playwright-go"
|
||||
"log"
|
||||
"os"
|
||||
@ -10,12 +11,23 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
var err error
|
||||
var noInstall = flag.Bool("no-install", false, "skip browser installation")
|
||||
var onlyInstall = flag.Bool("install", false, "install the required browser and do nothing else")
|
||||
flag.Parse()
|
||||
|
||||
options := &playwright.RunOptions{
|
||||
Browsers: []string{"firefox"},
|
||||
}
|
||||
err := playwright.Install(options)
|
||||
if err != nil {
|
||||
log.Panicf("error installing playwright: %v", err)
|
||||
if !*noInstall {
|
||||
err = playwright.Install(options)
|
||||
if err != nil {
|
||||
log.Panicf("error installing playwright: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if *onlyInstall {
|
||||
return
|
||||
}
|
||||
|
||||
db := openDatabase()
|
||||
|
Loading…
x
Reference in New Issue
Block a user