emacs-lsp / lsp-docker

Scripts and configurations to leverage lsp-mode in docker environment
GNU General Public License v3.0
251 stars 34 forks source link

Updated Dockerfile based on Ubuntu 21.04. plus a helper script. #49

Open illumino opened 3 years ago

illumino commented 3 years ago

Thank you for creating and maintaining the lsp-docker project.

I was looking at the project's Docker Hub images, and on noting their age, I looked at the Dockerfiles for each. I thought given the age of the distribution in use (Ubuntu 18.04), that the used products/packages are likely in the latest LTS version of Ubuntu (21.04).

So, I have created an updated Dockerfile using packages for all code built from a git repo (ccls, clangd, golang), but keeping the local build of Go, Node and Python language servers.

Additionally, I created a script (which could be included in the built container, if desired), that shows the installation location of each language server, and it's version (where I could determine that information)

Run on the existing Docker Hub Container images, gives:

docker run "emacslsp/lsp-docker-langservers" bash -c "$(cat ShowInstalledAndVersion.sh)"

gopls                       : /root/go/bin/gopls                         : version master, built in $GOPATH mode 
ccls                        : /usr/bin/ccls                              : ccls version <unknown> clang version 8.0.0 (tags/RELEASE_800/final) 
bash-language-server        : /usr/local/bin/bash-language-server        : Version is 1.17.0 
css-languageserver          : /usr/local/bin/css-languageserver          : UNKNOWN
docker-langserver           : /usr/local/bin/docker-langserver           : UNKNOWN
html-languageserver         : /usr/local/bin/html-languageserver         : UNKNOWN
pyls                        : /usr/local/bin/pyls                        : UNKNOWN
typescript-language-server  : /usr/local/bin/typescript-language-server  : 0.4.0

Run on the container created by the provided Dockerfile, gives:

docker run "${EMACS_LSP_TAG}" bash -c "$(cat ShowInstalledAndVersion.sh)"

gopls                       : /root/go/bin/gopls                         : golang.org/x/tools/gopls master  golang.org/x/tools/gopls@v0.7.3 h1:Lru57ht8vtDMouRskFC085VAjBAZRAISd/lwvwOOV0Q= 
ccls                        : /usr/bin/ccls                              : Ubuntu ccls version 0.20210330-1 clang version 12.0.0-3ubuntu1~21.04.2 
bash-language-server        : /usr/local/bin/bash-language-server        : Version is 2.0.0 
css-languageserver          : /usr/local/bin/css-languageserver          : UNKNOWN
docker-langserver           : /usr/local/bin/docker-langserver           : UNKNOWN
html-languageserver         : /usr/local/bin/html-languageserver         : UNKNOWN
pyls                        : /usr/local/bin/pyls                        : UNKNOWN
typescript-language-server  : /usr/local/bin/typescript-language-server  : 0.7.1 

As the container lsp-docker-langservers is the most important for the project, I have worked on and attached that. But in looking at the other Dockerfile (lsp-docker-full), I noted that it builds Emacs from git, and additionally that the Docker Hub image for this Dockerfile is stated as being two years old. For testing lsp-docker, I was using Emacs 26.1 on CentOS 8.4 and had no issues — so maybe that Dockerfile, could use the vendor package version of Emacs from Ubuntu 21.04 — just a thought.

The attached Dockerfile has some possible TODOs, which you can review/action/delete as you see fit.

Formally: I am the sole author of the attached script, and authored the modifications in the attached Dockerfile. I donate the two attached files to the lsp-docker project and/or its user community under the project's current license the GNU General Public License v3.0. The Dockerfile is a derived work, so immediately is licensed by the GPLv3.0. I also permit without further interaction with myself, that my contributions may be re-licenced to GNU General Public License v3.0 or later, should the current or future maintainers wish to do so.

I hope this contribution meets with your approval or benefits the lsp-docker community, Peter Bray Sydney, Australia

Dockerfile.txt ShowInstalledAndVersion.sh.txt

yyoncho commented 3 years ago

JFYI I am planning to gradually shift the effort towards https://github.com/emacs-lsp/lsp-gitpod (which also has docker image + some specifics). The idea is to have one unified docker image that can be used locally and via gitpod.