This article is part of a series to help newcomers to get started with Eclipse Theia development by setting up a local docker-based development environment for Theia.
So here it is. After over 10 years of Eclipse development, I wanted to get my hands dirty on something entirely new. I have followed the developments of Orion, Che, and Theia for a long time, but only from a distance; and I just didn’t have the time to actually try out, let alone to get involved with, these projects.
I have used Gitpod a few times, but merely to have a quick look into a GitHub repository when I didn’t have a local development environment and didn’t want to get one up and running.
Yet, I have noticed an increasing interest from my customers in web-based environments and so, I wanted to finally play around with Eclipse Theia.
But how? I have found this article which provides several options to run Eclipse Theia in different ways, but none of those options really hit the spot for me. I wanted to run a Theia instance in my browser, so Theia Blueprint was not an option. I wanted to be able to work offline, so using Gitpod was not possible. And I didn’t want to install nodejs on my machine. But still the goal was to get a basic Theia product up and running that should be ready to start hacking and customizing it, and then to jump in and create my first Theia extension.
I had started, and aborted again, several attempts to create a Docker container in which I could do that. But so far, I had not managed to create a smooth environment.
Then, recently, I found out about the Docker Dev Environments Preview. This is an experimental feature of Docker Desktop (there seems to be no CLI available for this functionality so far, and also, Docker Desktop is only available for Windows and MacOS). It glues together Git repository cloning, Docker container setup, and VS Code integration. This results in an easy process in which you can get an environment up and running locally with just a few clicks. It seems to be like a small sibling of Gitpod that can be run locally.
So, I have followed the instructions of Composing A Theia Application and have copied the
package.json from that page to a new folder on my PC. After playing around a bit with different Docker images, I have come up with this
To indicate that Docker Dev Environments shall use the
Dockerfile as its container definition, I also had to create a
docker-compose.yml file like this:
Getting started is now as simple as following these steps:
- Fork the repository on GitHub (or use mine to try it out)
- Open Docker Desktop, go to "Dev Environments" and click on "Create Dev Environment". Paste the GitHub URL and Continue. After some time, your Theia Dev Environment should now be up and running.
- Click "Open in VS Code". Your workspace should now contain the repository files. From now on, the instructions from https://theia-ide.org/docs/composing_applications can be followed:
- Open a new Terminal and enter
yarnto download all the Theia dependencies. (That might take quite some time…)
- After the process is finished, enter
yarn theia build, to build Theia. (Again, this might take some time; and don’t get discouraged by the warning about the filenamify module)
- Finally enter
yarn theia start --plugins=local-dir:pluginsand Theia will come up at
http://localhost:3000(VS Code will announce this and offer to open a browser)
And we are ready to go. From here, we have a running Theia that can be modified and customized by adding and changing files in VS Code and managing Theia in the VS Code Terminal. As a next step, we can, for example, jump into Authoring a Theia Extension.