R
Railway12mo ago
ryans

playwright in a flask app

How can I install playwright in a flask app? On my local, I do playwright install after I install it with pip3. Please help. Thanks
Solution:
add a new phase that will run that command, have the phase depend on the pre-existing install phase https://nixpacks.com/docs/guides/configuring-builds#new-phase...
Jump to solution
14 Replies
Percy
Percy12mo ago
Project ID: N/A
ryans
ryans12mo ago
N/A
Solution
Brody
Brody12mo ago
add a new phase that will run that command, have the phase depend on the pre-existing install phase https://nixpacks.com/docs/guides/configuring-builds#new-phase
Brody
Brody12mo ago
these configurations are done in a nixpacks.toml file
ryans
ryans12mo ago
Thanks. Where do I put the file? I just need to run “playwright install”. I’ve only used preconfigured settings before
Brody
Brody12mo ago
you'd put that file in your project folder
ryans
ryans12mo ago
So will it do pip install requirements, then playwright install, then start flask app?
Brody
Brody12mo ago
pip install -r requirements is already done by default for you have you checked out the document fragment I linked?
ryans
ryans12mo ago
I’m on mobile. Will check it out later and reply back. Thank you
Brody
Brody12mo ago
sounds good
ryans
ryans12mo ago
Is this correct for the file? [phases.build] cmds = ["playwright install"] dependsOn = ["install"] Getting this error: #12 [stage-0 8/10] RUN playwright install  #12 0.371 /bin/bash: line 1: playwright: command not found #12 ERROR: process "/bin/bash -ol pipefail -c playwright install" did not complete successfully: exit code: 127 -----
[stage-0 8/10] RUN playwright install:
#12 0.371 /bin/bash: line 1: playwright: command not found  ----- Dockerfile:24 ------------------- 22 | # build phase 23 | COPY . /app/. 24 | >>> RUN playwright install 25 | 26 | ------------------- ERROR: failed to solve: process "/bin/bash -ol pipefail -c playwright install" did not complete successfully: exit code: 127  Error: Docker build failed oh wait, it actually worked nice
Brody
Brody12mo ago
I mean I would have choose to call the phase playwrite instead of build but you do you lol
ryans
ryans12mo ago
@Brody noted, so you suggest: [phases.playwright] cmds = ["playwright install"] dependsOn = ["install"]
Brody
Brody12mo ago
yep, looks good to me