-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[universal] - Issue universal config change for non-root default codespace user and installing google chrome browser reuse sandboc to run puppeteer cli in universal image #1287
base: main
Are you sure you want to change the base?
Changes from 8 commits
8dd6829
1cb542b
55086d0
d8db581
5ff7666
bdd690b
bd1149f
f13430c
8aa5786
af2f6b5
0dd9b52
c2e8b2c
cede6c1
bcccb04
be29d05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,19 @@ check "zsh" zsh --version | |
check "RAILS_DEVELOPMENT_HOSTS is set correctly" echo $RAILS_DEVELOPMENT_HOSTS | grep ".githubpreview.dev,.preview.app.github.dev,.app.github.dev" | ||
|
||
# Check that we can run a puppeteer node app. | ||
# installing google chrome for puppeteer | ||
cd / | ||
sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | ||
sudo dpkg -i google-chrome-stable_current_amd64.deb | ||
|
||
cd /opt/google/chrome/ | ||
sudo chown root:root chrome-sandbox | ||
sudo chmod 4755 chrome-sandbox | ||
sudo cp -p chrome-sandbox /usr/local/sbin/chrome-devel-sandbox | ||
|
||
# export CHROME_DEVEL_SANDBOX env variable | ||
export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox | ||
cd /workspaces/images/src/universal/test-project/ | ||
yarn | ||
check "run-puppeteer" node puppeteer.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this command work on the container when the user runs it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @eljog , My idea was that the main objective behind this particular test "run-puppeteer" was to demonstrate that puppeteer cli library can be used in a node app & the same cane be executed in the universal image. So I changed it in the test.sh alone considering that & also due to the fact that as part of the solution I am downloading & installing google chrome in the image which increases the image size if done as part of the build. Now I have changed that. Following points are needed to be considered for this change.
Kindly let me know in case of any concerns on this. With Regards, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern is more about the user experience here. Tagging other maintainers for their thoughts. @chrmarti @bamurtaugh There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hi @eljog , Actually right now in the image built on top of ubuntu-24.04 runner image in CI, no sandbox is available to reuse for puppeteer node app which forces us to install chrome as it comes with sandbox & also due to enhanced security feature of ubuntu-24.04, its not possible to create sandbox without enabling user namespace cloning which still has some vulnerabilities. puppeteer/puppeteer#12818 (comment) With Regards, |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I know why this need to be a
postStartCommand
?postStartCommand
re runs on every time container is restarted. We need to do this work only onceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @eljog ,
Indeed it would be executed during every restart. Initially I saw that as part of configurations in one of the features of universal image, git-lfs has already got postCreateCommand used in devcontainer-feature.json. So I avoided the postCreateCommand option & opted for postStartCommand.
However, I have checked now that for a devcontainer configuration if the same lifecycle hook such as postCreateCommand is used in both devcontainer-feature.json & devcontainer.json, then the commands provided in the devcontainer-feature.json would be executed first followed by the commands in devcontainer.json. So I changed that & tested the same now. Kindly let me know in case of any further concerns on this.
With Regards,
Kaniska