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 ./
|
COPY *.go ./
|
||||||
RUN go build -o /vivaplusdl
|
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 (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"flag"
|
||||||
"github.com/playwright-community/playwright-go"
|
"github.com/playwright-community/playwright-go"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -10,12 +11,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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{
|
options := &playwright.RunOptions{
|
||||||
Browsers: []string{"firefox"},
|
Browsers: []string{"firefox"},
|
||||||
}
|
}
|
||||||
err := playwright.Install(options)
|
if !*noInstall {
|
||||||
if err != nil {
|
err = playwright.Install(options)
|
||||||
log.Panicf("error installing playwright: %v", err)
|
if err != nil {
|
||||||
|
log.Panicf("error installing playwright: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if *onlyInstall {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
db := openDatabase()
|
db := openDatabase()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user