Closed dxkrs closed 4 months ago
Ah I think we are missing the krb5 dependency in our Alpine instructions. Maybe try installing krb5-dev
.
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?
Ah you probably need to bind to 0.0.0.0
. If you use 127.0.0.1
then nothing outside the container can access it, even if the port is exposed.
8. npm install --global code-server --unsafe-perm
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.
Closing for now since there are no action items for code-server. Tracking for potentially adding an official Alpine release is here: https://github.com/coder/code-server/issues/3431
@code-asher Do you have a working alpine Dockerfile
are 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.
No, I do not, but I tried building code-server on Alpine just now and these commands worked:
docker run -p 8080:8080 -it node:20.11.1-alpine sh
apk add git quilt python3 alpine-sdk libx11-dev libxkbfile-dev libstdc++ libc6-compat libsecret-dev jq rsync
git clone --recursive https://github.com/coder/code-server.git
cd code-server
quilt push -a
# Skipping kerberos since it fails to build and is optional anyway
sed -i 's/"kerberos": "^2.0.1",//' lib/vscode/package.json
sed -i 's/"kerberos": "^2.0.1",//' lib/vscode/remote/package.json
yarn install
yarn build
VERSION=4.91.1 yarn build:vscode
yarn release
yarn release:standalone
./release-standalone/bin/code-server --host 0.0.0.0
It would also normally be possible to package it withVERSION=4.91.1 yarn package
to generate a tar.gz file but it looks like the version of tar in Alpine does not like the flags we use.
Thanks to @code-asher, for the information if you need to deploy code-server into an alpine container, you can use the following Dockerfile :
FROM node:20-alpine AS code-builder
RUN apk update && \
apk upgrade
RUN apk add bash git alpine-sdk quilt krb5-dev libx11-dev \
libxkbfile-dev libstdc++ libc6-compat libsecret-dev jq rsync
RUN git clone --recurse-submodules --shallow-submodules \
--depth 1 https://github.com/coder/code-server.git \
/code-server
RUN cd /code-server && quilt push -a
RUN cd /code-server && npm install
RUN cd /code-server && npm run build
RUN cd /code-server && VERSION='0.0.0' npm run build:vscode
RUN cd /code-server && npm run release
RUN cd /code-server && npm run release:standalone
FROM alpine:latest
RUN apk update && \
apk upgrade
RUN apk add libstdc++
COPY --from=code-builder /code-server/release-standalone /opt/code-server
CMD ["/opt/code-server/bin/code-server","--host","0.0.0.0"]
Be ready because the VS Code build is around ~30 minutes with 6 CPU and 12 gigabytes of RAM.
Is there an existing issue for this?
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.4
apk update && apk add alpine-sdk bash libstdc++ libc6-compat
apk add python3
apk add nodejs=18.18.2-r0
apk add npm
npm config set python python3
, this command will error, then I try it thenpm config edit
and add the 'python=python3` in the open fileexport FORCE_NODE_VERSION=18
npm 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
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
Are you accessing code-server over 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?