I need to run a local language server as a docker container by including it in a dockerfile. I built a simple language server following only the section under "Provide the Xtext Language Server". This is the Dockerfile I wrote to build the image:
FROM eclipse/che
ADD xtextls3 C:\Users\abc\xtext_ls3
RUN sudo apt-get install socat -y
CMD socat TCP4-LISTEN:4417,reuseaddr,form EXEC:"xtextls"
I don't know whether this is correct. "xtextls3" is the eclipse workspace folder I used to create my language server. When I try to build this dockerfile, I get this error: ADD failed: stat /var/lib/docker/tmp/docker-builder342449789/xtextls3
What is the correct method to include my language server in a dockerfile, and build a docker image from it?
I might think that the problem lies in the ADD line. This adds the local file xtextls3
to your layer. However, the file cannot be found. I have the idea that you have to swap the first and second argument on the ADD-instruction.
It seems that I should be stating the path in relation to the context directory (current location I'm at in the command prompt). I placed my .jar file in the same folder where the Dockerfile is and changed the Dockerfile content as follows:
FROM barais/eclipse-xtend
ADD build/libs/dsl-language-server-ls.jar dsl-language-server-ls.jar
RUN sudo apt-get install socat
CMD socat TCP4-LISTEN:4417,reuseaddr,fork EXEC:"mydsl"
"build/libs/dsl-language-server-ls.jar" is the path+file, and "dsl-language-server-ls.jar" is the binary file that I require.
来源:https://stackoverflow.com/questions/52605341/how-to-include-a-local-language-server-in-a-dockerfile-and-build-a-docker-image