如何在dockerfile中包含本地语言服务器并从中构建docker映像? [英] How to include a local language server in a dockerfile and build a docker image from it?

查看:102
本文介绍了如何在dockerfile中包含本地语言服务器并从中构建docker映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过将本地语言服务器包含在dockerfile中来将其作为docker容器运行。我仅按照提供Xtext语言服务器下的部分构建了一个简单的语言服务器。
这是我为构建映像而编写的Dockerfile:

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"

我不知道这是否正确。 xtextls3是我用来创建语言服务器的Eclipse工作区文件夹。当我尝试构建此dockerfile时,出现以下错误:
ADD失败:stat / var / lib / docker / tmp / docker-builder342449789 / xtextls3

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

将我的语言服务器包含在dockerfile中并构建docker的正确方法是什么

What is the correct method to include my language server in a dockerfile, and build a docker image from it?

推荐答案

似乎我应该说明相对于上下文目录的路径 >(我在命令提示符下的当前位置)。我将.jar文件放在Dockerfile所在的文件夹中,并按如下所示更改Dockerfile内容:

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是路径文件, dsl-language-server-ls.jar是我需要的二进制文件。

"build/libs/dsl-language-server-ls.jar" is the path+file, and "dsl-language-server-ls.jar" is the binary file that I require.

这篇关于如何在dockerfile中包含本地语言服务器并从中构建docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆