Repository navigation
What is the correct way to deploy the code-server on alpine? #6535
Copy link
Copy link
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workingtriageThis issue needs to be triaged by a maintainerThis issue needs to be triaged by a maintainer
Description
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
alpine3.18.4 in docker container
Steps to Reproduce
I try to step by step with the offical docs.
docker run --ti alpine:3.18.4apk update && apk add alpine-sdk bash libstdc++ libc6-compatapk add python3apk add nodejs=18.18.2-r0apk add npmnpm config set python python3, this command will error, then I try it thenpm config editand add the 'python=python3` in the open fileexport FORCE_NODE_VERSION=18npm install --global code-server --unsafe-perm
Expected
success deploy the code-server
Actual
Print a log of error at the last step.
I see the err tips:"You may not have the required dependencies to build the native modules", then I try to see the lists Node.js requirements and confirm the prerequisites, but also not success.
Logs
/ # npm install --global code-server --unsafe-perm
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/code-server
npm ERR! command failed
npm ERR! command sh -c sh ./postinstall.sh
npm ERR! WARNING: Overriding required Node.js version to v18
npm ERR! This could lead to broken functionality, and is unsupported.
npm ERR! USE AT YOUR OWN RISK!
npm ERR! Installing Code dependencies...
npm ERR! User agent: npm/9.6.6 node/v18.18.2 linux x64 workspaces/false
npm ERR! You may not have the required dependencies to build the native modules.
npm ERR! Please see https://github.com/coder/code-server/blob/main/docs/npm.md
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c prebuild-install --runtime napi || node-gyp rebuild
npm ERR! npm ERR! make: Entering directory '/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos/build'
npm ERR! npm ERR! CXX(target) Release/obj.target/kerberos/src/kerberos.o
npm ERR! npm ERR! make: Leaving directory '/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos/build'
npm ERR! npm ERR! prebuild-install warn install No prebuilt binaries found (target=4 runtime=napi arch=x64 libc=musl platform=linux)
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp info using node-gyp@9.3.1
npm ERR! npm ERR! gyp info using node@18.18.2 | linux | x64
npm ERR! npm ERR! gyp info find Python using Python version 3.11.6 found at "/usr/bin/python3"
npm ERR! npm ERR! gyp info spawn /usr/bin/python3
npm ERR! npm ERR! gyp info spawn args [
npm ERR! npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! npm ERR! gyp info spawn args '-f',
npm ERR! npm ERR! gyp info spawn args 'make',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos/build/config.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args '/root/.cache/node-gyp/18.18.2/include/node/common.gypi',
npm ERR! npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.18.2',
npm ERR! npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.18.2/<(target_arch)/node.lib',
npm ERR! npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos',
npm ERR! npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! npm ERR! gyp info spawn args '--depth=.',
npm ERR! npm ERR! gyp info spawn args '--no-parallel',
npm ERR! npm ERR! gyp info spawn args '--generator-output',
npm ERR! npm ERR! gyp info spawn args 'build',
npm ERR! npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! npm ERR! gyp info spawn args ]
npm ERR! npm ERR! gyp info spawn make
npm ERR! npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! npm ERR! In file included from ../src/kerberos_common.h:5,
npm ERR! npm ERR! from ../src/kerberos.h:12,
npm ERR! npm ERR! from ../src/kerberos.cc:1:
npm ERR! npm ERR! ../src/unix/kerberos_gss.h:21:14: fatal error: gssapi/gssapi.h: No such file or directory
npm ERR! npm ERR! 21 | #include <gssapi/gssapi.h>
npm ERR! npm ERR! | ^~~~~~~~~~~~~~~~~
npm ERR! npm ERR! compilation terminated.
npm ERR! npm ERR! make: *** [kerberos.target.mk:110: Release/obj.target/kerberos/src/kerberos.o] Error 1
npm ERR! npm ERR! gyp ERR! build error
npm ERR! npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm ERR! npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12)
npm ERR! npm ERR! gyp ERR! System Linux 3.10.0-1160.83.1.el7.x86_64
npm ERR! npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos
npm ERR! npm ERR! gyp ERR! node -v v18.18.2
npm ERR! npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! npm ERR! gyp ERR! not ok
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-15T11_07_26_826Z-debug-0.log
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-15T11_07_16_538Z-debug-0.log
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
- I cannot reproduce this in VS Code.
- I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over a secure context?
- I am using a secure context.
Notes
So, what the correct way to deploy the code-server on alpine? Or is it not support the alpine in docker?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriageThis issue needs to be triaged by a maintainerThis issue needs to be triaged by a maintainer
Activity
code-asher commentedon Nov 17, 2023
Ah I think we are missing the krb5 dependency in our Alpine instructions. Maybe try installing
krb5-dev.https://github.com/mongodb-js/kerberos#requirements
bjohnson0524 commentedon Mar 11, 2024
I have followed the above steps. When I type code-server on the command line, the message says the server is at http://127.0.0.1:8080, but I can't pull anything up in the browser. I am attaching pictures. Anything else I can check?



code-asher commentedon Mar 11, 2024
Ah you probably need to bind to
0.0.0.0. If you use127.0.0.1then nothing outside the container can access it, even if the port is exposed.bjohnson0524 commentedon Mar 12, 2024
Thanks. As you suggested, I changed 127.0.0.1 to 0.0.0.0 in the config.yaml file. I restarted the container and now it works.
code-asher commentedon Jul 12, 2024
Closing for now since there are no action items for code-server. Tracking for potentially adding an official Alpine release is here: #3431
gjrtimmer commentedon Aug 2, 2024
@code-asher Do you have a working alpine
Dockerfileare you willing to share it here in a post, been trying to get an alpine build up and running for several days now, still no luck with the latest 4.91.1 and alpine 3.20 or 3.19, so I hope you are willing to share.code-asher commentedon Aug 2, 2024
No, I do not, but I tried building code-server on Alpine just now and these commands worked:
It would also normally be possible to package it with
VERSION=4.91.1 yarn packageto generate a tar.gz file but it looks like the version of tar in Alpine does not like the flags we use.Cedric-Thomas commentedon Nov 15, 2024
Thanks to @code-asher, for the information if you need to deploy code-server into an alpine container, you can use the following Dockerfile :
Be ready because the VS Code build is around ~30 minutes with 6 CPU and 12 gigabytes of RAM.