首先,问题是:有没有办法为 GitHub Codespace 选择平台(例如 x86_64、AMD64、ARM64)?
这是我到目前为止发现的:
尝试1(不起作用):
在 GitHub.com 中,您可以为 Codespace 选择“机器”,但唯一的选项是 RAM 和磁盘大小。
尝试2(编辑:不起作用): devcontainer.json
创建 Codespace 时,您可以通过创建包含两个文件的顶级.devcontainer文件夹来指定选项:devcontainer.json和Dockerfile
在这里您可以自定义运行时、安装的软件包等,但文档没有提及任何有关确定架构的信息...
...但是,VSCode 文档devcontainer.json有一个runArgs选项,“接受 Docker CLI 参数”...
--platform 上的 Docker CLI 文档说你应该能够传递--platform linux/amd64or --platform linux/arm64,但是......
当我尝试这样做时,代码空间会挂起,永远不会完成构建。
尝试 3(进行中):指定Dockerfile
这条路线似乎是最有前途的,但它对我来说都是新的(容器化、代码空间、docker)。尝试 2 和尝试 3 可能会同时发挥作用。不过,目前有太多新的动人的部分,我需要外部帮助。
dpkg --print-architecture或uname -a]参考资料:
https://code.visualstudio.com/docs/remote/devcontainerjson-reference
https://docs.docker.com/engine/reference/commandline/run/
https://docs.docker.com/engine/reference /builder/ …
github docker codespaces vscode-devcontainer github-codespaces
假设我index.html在 GitHub Codespaces 中有这个文件:
<h1>Hello world</h1>
Test text
Run Code Online (Sandbox Code Playgroud)
如何在 GitHub Codespaces 中预览 HTML 文件?最好在 VS 代码选项卡上。
编辑:事实证明这是 Brave 浏览器中的一个错误。maddes8cht 的建议在 Chrome 中运行良好。
I'm trying out Github codespaces, specifically the "Node.js & Mongo DB" default settings.
The port is forwarded, and my objective is to connect with MongoDB Compass running on my local machine.
The address forwarded to 27017 is something like https://<long-address>.githubpreview.dev/
I attempted to use the following connection string, but it did not work in MongoDB compass. It failed with No addresses found at host. I'm actually unsure about how I even determine if MongoDB is actually running …
我有一个安装了一堆开发工具的 Codespace。
我想使用此 Codespace 作为模板,以便我可以从那里开始新项目。
我可以创建一个安装该工具的 Dockerfile,然后从中构建一个新的 Codespace。
但是有没有一种方法可以从现有的代码空间创建一个新的代码空间?
我尝试在 GitHub Codespaces 中以可见模式运行 Puppeteer 时遇到问题。
我猜是因为 GitHub 没有渲染器以及本地计算机。
有什么方法可以运行 Puppeteer,将其连接到端口以使其可见或其他替代方案,希望对您有所帮助。
我希望它以这种模式运行:
const browser = await puppeteer.launch({ headless: false });
Run Code Online (Sandbox Code Playgroud)
我已经测试过: - 安装一个视图服务器,例如Xvfb。- 配置 Puppeteer 以使用视图服务器。
const browser = await puppeteer.launch({ headless: false, args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'], env: { DISPLAY: ':99' } });
-我没有获得好的结果
我希望:在 GitHub Codespaces 或其他替代方案中的端口上运行 Puppeteer。