Closed MatejKastak closed 3 years ago
I'm not sure the example would be useful for others (since it is not the recommended way of building an application as it offers no ability to modify/extend it easily). I also believe the example is quite simply. The idea would be to clone the main repository in the container, build it, and start it. In theia-apps
we define a package.json
of custom applications, but for this use-case we would not pull from npm
but rather clone the repo. I'm not sure where the actual difficulty lies.
Thanks for your response.
but for this use-case we would not pull from npm but rather clone the repo. I'm not sure where the actual difficulty lies.
I understand what you mean by this, but I am not able to get it to work. Can you please share with me some links or documentation on how to achieve this (I tried yarn link
with no success)? Any help is appreciated. I would like to build the master
theia and then use packages built in this step to build my custom application.
Dockerfile
can look something like this (pseudo code):1) Setup the system dependecies (for example based on https://github.com/theia-ide/theia-apps/blob/master/theia-docker/Dockerfile)
1) RUN git clone https://github.com/eclipse-theia/theia /home/app/theia
2) RUN cd /home/app/theia && yarn
3) ADD package.json /home/app/custom-browser/package.json
4) RUN ??? <build theia app using dependencies from /home/app/theia>
It is not very clear to me how to build the theia application using the dependencies I have built in /home/app/theia
5) Somehow start the custom theia app, I tried multiple approaches
ENTRYPOINT ["node", "/home/app/custom-browser/src-gen/backend/main.js", "/home/project", "--hostname=0.0.0.0"]
ENTRYPOINT ["yarn", "run", "start:browser", "--hostname=0.0.0.0"]
home
└── app
├── custom-browser
│ └── package.json # package json for my custom app, with plugin definitions and such
└── theia # git clone https://github.com/eclipse-theia/theia
Hi @MatejKastak,
Interesting idea. One unknown in my mind is how to strip the example browser application so we can use it in the container, hopefully without carrying the whole built repo, in the image.
In any case I think it should not be too hard to do. Do you have a starting point, maybe a prototype you attempted, that we could help fix instead of starting from scratch?
Hi @marcdumais-work , thanks for the response.
I have created a commented minimal example @ https://github.com/MatejKastak/theia-build-test . You can build it with make build
and then test it with make run
.
Currently this makes a valid browser application, but I don't think it uses the node modules built from sources.
What do you suggest? Can you see any outright mistakes? I am using yarn link
which might be not correct. Maybe a little pseudo parallel with python with what I am trying to achieve :slightly_smiling_face: :
python -m venv env # I would create a virual-env
source env/bin/activate # Load the virtual env, for subsequent commnads
cd /theia && python setup.py install # Build and install theia
cd /app && python setup.py install # ~ This would use the installed theia in virtual env instead of downloading a new one
@MatejKastak I have just documented a way to do something I think similar to what you want to achieve. I did it in a Gitpod container, but you could do it locally. In short I publish an arbitrary version of Theia in a local registry (verdaccio) and then build a Theia app from what I published: https://github.com/eclipse-theia/theia/pull/8880#issuecomment-762486659
Hi @marcdumais-work , thanks for the response.
I have created a commented minimal example @ https://github.com/MatejKastak/theia-build-test . You can build it with
make build
and then test it withmake run
.Currently this makes a valid browser application, but I don't think it uses the node modules built from sources.
What do you suggest? Can you see any outright mistakes?
I had a quick look and thought I did not see any outright mistakes, I have the feeling that you may be close to a solution, or that it should be possible to do something like this. But consider the local registry option above, too.
This contribution has been automatically marked as stale due to inactivity, and it will be closed if no further activity occurs. Thank you for contributing to Theia!
Hello,
my goal is to build a docker container with theia from sources, meaning that for example I would build current
master
with some custom patches/commits. I wasn't able to find an example how to do this.I will gladly contribute example like this (maybe it will be useful also to others). But I don't have much experience with Js/Ts project that are this complex, so I would welcome any guidance.
It should be sufficient to create bare theia container, that would
git clone theia-repo
and then build it instead of using packages from npm. This way users can substitute their own repo or do anything with cloned sources. I know about thenext
version tag, but I believe it's not relevant in this usecase.I think example like this can fit into additional-docker-examples section in README.
I have followed Developing.md and also tried to work with theia-cli.
Any suggestions appreciated.