Git Product home page Git Product logo

dockerfiles's Introduction

dockerfiles

Dockerfiles for all LSPs used with lspcontainers.

Installation

This repository requires the latest:

Build

To build images locally run:

  • docker-compose build <server> to build a specific server (see docker-compose.yaml)
  • docker-compose build to build all servers
  • docker-compose build --parallel to build all servers in parallel

Versions

Every container has two tags available:

  • The latest tag, which points to the latest container build

  • A pinned version. The pinned version will be the latest version of the language server.

dockerfiles's People

Contributors

adrianord avatar cappyzawa avatar d0nkarnag3 avatar danielpieper avatar dbgeek avatar disrupted avatar erikreinert avatar iaroki avatar jgero avatar kencx avatar kesor avatar nogweii avatar pbdeuchler avatar rudesome avatar sharksforarms avatar solarshado avatar thismat avatar whynothugo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dockerfiles's Issues

Seperate monolithic Dockerfile

I feel that a monolithic Dockerfile might not fit this project like it would a mono-repo with services that depend on each other or share a common build paths. This couples languages very early on even if their build paths have nothing similar and (in my opinion) hurts readability. This will also cause an increasing amount of merge conflicts as people submit new languages at the same time and as the file grows. This is a very common problem with dotnet's solution file early on in a project when everyone is modifying it to make new projects in the solution. I don't think it does anything to optimize the actual image sizes as they are still larger than when we had first started, at least the images based on vscode-languageserver-node. We had also removed the .env and node_base images to reduce coupling in the past.

To summarize:

  • Leads to unnecessary coupling which could hurt maintainability and readability
  • Some languages in the Dockerfile share no common build paths
  • Even if they share a common build path like vscode-languageserver-node it might still be a good idea not to couple the languages for ease maintainability.
  • A monolithic Dockerfile that everybody must touch will cause merge conflicts for contributors adding their language to it at the same time.

(A secondary concern is this file grows so large with so many languages that the project require Git LFS as I have seen this happen with regularly text file, but this would happen very far down the line.)

GoPls won't start to incomaptible platform.

Hey 👏

I get Client 2 quit with exit code 1 and signal 0 when using GOPLS lsp. Did LSP log and go this:
Skärmavbild 2022-10-12 kl  00 21 54

Also get a error with rust analyzer:
Skärmavbild 2022-10-12 kl  00 32 09

I think it has something to do with my machine. I have Macbook Pro M1.

I've tried to fix the problem myself but it's out of my knowledge. Let me know if I can provide with anything.

Any idea what might be wrong? :D

Proposed Language Servers

This issue provides context to language servers we may be missing and or need to add to LSPContainers. Below is an periodically updated list for language servers we plan to implement in the near future.

Please add a comment to this issue if you don't see a language server you'd like to see implemented.

Current Proposed:

  • dart
  • denols
  • elixirls
  • elmls
  • gradle_ls
  • jdtls
  • omnisharp
  • perlls
  • phpactor
  • prisma - #72
  • remark_ls
  • tailwind - #74

Usage example

Hi! Thank you for an awesome repo. But I didn't get how to practically use these containers.

For example, lspcontainers/typescript-language-server immediately closes after run. How to interact with it?

Prisma language server

Problem

We need to add prisma language server for some work I will be doing with the ORM.

`gopls` cannot run becuase it uses a custom user

gopls uses a custom user inside the container. This user will never match the uid of the user running the container on the host (the uid of the containerised users is mapped to an uid in the host in the range definedin /etc/subuid).

Since my projects are in my $HOME, the user inside gopls can't access it, and fails with Permission denied. It's only really possible to work on project that are world readable.

I'm looking at #63, and I don't think this change really makes sense; it you use root inside the container, that root user will have the uid of the user running docker / podman on the host. #63 would only make sense if you're running docker/podman as root, but that doesn't seem like a very sensible thing to do, especially for LSPs. I think if you do so, it'd be possible for the LSP to read-write files on the host that are only readable by root.

I think it's probably best to revert #63, and discourage users from running the LSP containers as root in the first place.

Solargraph: Client 1 quit with exit code 127

It seems like the container for Solargraph it's not working by default. I'll try to fix it and make a PR later.

[ERROR][2021-11-16 19:59:22] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"Unable to find image 'lspcontainers/solargraph:0.43.0' locally\n"
[ERROR][2021-11-16 19:59:25] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"0.43.0: Pulling from lspcontainers/solargraph\n"
[ERROR][2021-11-16 19:59:25] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"540db60ca938: Already exists\n"
[ERROR][2021-11-16 19:59:25] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"fe842b3d4a63: Pulling fs layer\n2e6f35e90723: Pulling fs layer\n"
[ERROR][2021-11-16 19:59:31] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"2e6f35e90723: Verifying Checksum\n2e6f35e90723: Download complete\n"
[ERROR][2021-11-16 19:59:35] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"fe842b3d4a63: Verifying Checksum\nfe842b3d4a63: Download complete\n"
[ERROR][2021-11-16 19:59:39] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"fe842b3d4a63: Pull complete\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"2e6f35e90723: Pull complete\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"Digest: sha256:b58682589047f5f07af774126c84a871122ba5d76f4ec5b052a82d259788b1f5\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	"Status: Downloaded newer image for lspcontainers/solargraph:0.43.0\n"
[ERROR][2021-11-16 19:59:40] .../vim/lsp/rpc.lua:412	"rpc"	"docker"	"stderr"	'docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/usr/local/bundle/bin/solargraph": stat /usr/local/bundle/bin/solargraph: no such file or directory: unknown.\n'

terraformls - need terraform binary inside the image

Formatting terraform/hcl code does not work. It needs the terraform binary install in the image. See the error message below.

How should we keep track of the two different versions(terraformls, terraform)?

Error message in the lsp.log

[ ERROR ] 2021-05-17T16:10:10+0200 ] ...im/HEAD-e0a01bd_2/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]  "rpc"   "docker"      "stderr" '2021/05/17 14:10:10 rpc_logger.go:45: Error for "textDocument/formatting" (ID 2): [-32098] Terraform (CLI) is required. Please install Terraform or make it available in $PATH\n2021/05/17 14:10:10 server.go:247: Completed 1 requests [196.468µs elapsed]\n'

Changes from issue #6

To iterate over the changes made in #6 the following updates should be made:

  • Remove the args implementation
  • Remove the base image implementation
  • Adds pyright from dockerfiles issue #4

Do we want to run hadolint on the dockerfiles?

Do we want to run hadolint as part of the CI?

Here is the current output:

servers/bashls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/dockerls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/gopls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/pyls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/pyls/Dockerfile:4 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
servers/pyls/Dockerfile:7 SC2102 info: Ranges can only match single chars (mentioned due to duplicates).
servers/pyright/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/rust_analyzer/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/rust_analyzer/Dockerfile:10 DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check
servers/rust_analyzer/Dockerfile:10 SC2086 info: Double quote to prevent globbing and word splitting.
servers/sumneko_lua/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/sumneko_lua/Dockerfile:14 DL3003 warning: Use WORKDIR to switch to a directory
servers/sumneko_lua/Dockerfile:18 DL3003 warning: Use WORKDIR to switch to a directory
servers/sumneko_lua/Dockerfile:18 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
servers/svelteserver/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/terraformls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/terraformls/Dockerfile:9 SC2005 style: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
servers/tsserver/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
servers/tsserver/Dockerfile:9 DL3016 warning: Pin versions in npm. Instead of `npm install <package>` use `npm install <package>@<version>`
servers/yamlls/Dockerfile:3 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`

Support Multi-Arch Builds

Problem

We have found that some users rely on M1 and other incompatible processors for running lspcontainers. As mentioned in #86 there are other possible work around - however we would much rather natively support the arch.

Svelte formatting

With the current docker image formatting does not work for me. But in the docs of the svelte-language-server it says that it supports formatting via prettier. I tried installing prettier and prettier-plugin-svelte in the container as well but still no success. Would it be possible to make formatting work with the lspcontainers or do I have to make that work another way?

Solution for project packages

Since my dev environment runs into a docker container, my LSP is unable to find the project packages and had to install the LSP locally. This nvim package solves the second issue, but still misses a solution for getting project packages.
I have done a temporal solution at my config (#46 (comment)).

I think this issue affects all the languages that use packages. I would like to start a discussion if these issue has to be solved at the package.

Setup build pipelines

This will set up a basic pipeline for one language server to test out Github Actions. If successful, I will create another PR with the changes for the rest of the LSPs.

Optimize LSP Images

The goal here is simple - make the smallest images possible without spending a lot of time on each one.

rust-analyzer needs access to `$RUSTUP_HOME`.

rust-analyzer attempts to access crates for the current project, which are usually stored in ~/.cache/cargo. This should be mounted as a volume.

Without this directory:

  • The language server needs network access (non-ideal).
  • The language server will download and compile all dependencies on each run, which is extremely slow and consumes a lot of network.

This isn't the first LSP to require an additional volume for this kind of usage. I'm thinking of maybe adding an extra item to objects in the supported_languages table (e.g.: extra_volumes), with paths to additional volumes that they each require.

This provides a base onto which individual LSPs can specify extra volumes (and, probably, whether these volumes should be :roor :rw).

Improve Contributing Documentation

Need to improve the README around what requirements must be completed before being able to merge a new language server to the project.

Requirements:

  • Github Workflow
  • Local Development
  • Versioning

Migrate builds to Nix

Overview

The idea here is I'd like to try and see if we can build all LSP images with Nix so that they are as lightweight as possible and contain all requirements only without other dependencies.

Support Multi-Version Languages

Problem

Some languages support multiple versions (stable, lts, etc) that users may work with when developing applications. It would be good to support those variants for the given languages. Referenced #60

Automating Version Updates

Proposed Changes

Now that we have accumulated a decent amount of LSPs it would be great to find a way to automate the process of updating the images in sync with their latest versions.

Proposed V2 Updates

Overview

I want to re-write lspcontainers from scratch considering all of the challenges we have faced over the past year working on the project.

Features

  • all LSP images are built with Nix
  • standardize a way we define LSPs (so it's easy to add new ones in the future)

bashls crashes after a short while

bashls crashes after a short while.

I noticed the Dockerfile doesn't install bash, so I tried adding that:

diff --git a/servers/bashls/Dockerfile b/servers/bashls/Dockerfile
index 4a528f1..89f44f8 100644
--- a/servers/bashls/Dockerfile
+++ b/servers/bashls/Dockerfile
@@ -2,7 +2,8 @@ FROM alpine:3.13.5

 RUN apk add --no-cache \
   nodejs \
-  npm
+  npm \
+  bash

 ARG VERSION

I also tried updating to the latest version, but that didn't fix it either:

Here's my very simple test.bash:

#!/usr/bin/bash

echo $*

All I can see is that it exits 1. The container's logs don't yield any clues either.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.