This repository has been archived by the owner on Oct 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instructions to build and package Theia into a rpm for easy distribut…
…ion. Tested and evaluated for CentOS/RH Linux 7. Older OS versions are not supported. For new version support, watch bbc/speculate#75 Signed-off-by: Joshua Bradley <[email protected]>
- Loading branch information
1 parent
ef7c396
commit 361efcc
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM centos:7 | ||
# install development tools | ||
RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - && \ | ||
yum groupinstall -y "Development Tools" && \ | ||
yum install -y nodejs && \ | ||
npm install -g yarn | ||
|
||
# required file to install Theia | ||
COPY package.json run_theia.sh /theia-app/ | ||
|
||
# build theia | ||
WORKDIR /theia-app | ||
RUN yarn && \ | ||
NODE_OPTIONS="--max_old_space_size=4096" yarn theia build && \ | ||
yarn autoclean --init && \ | ||
echo *.ts >> .yarnclean && \ | ||
echo *.ts.map >> .yarnclean && \ | ||
echo *.spec.* >> .yarnclean && \ | ||
yarn autoclean --force && \ | ||
yarn cache clean | ||
|
||
# create theia rpm | ||
RUN npm run build-rpm | ||
|
||
# transfer rpm to new clean image and demonstrate successful rpm install (yum will handle all rpm dependencies i.e. Node v10) | ||
FROM centos:7 | ||
COPY --from=0 /root/rpmbuild/RPMS/x86_64/theia-0.0.1-1.x86_64.rpm / | ||
RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - && \ | ||
yum install -y theia-0.0.1-1.x86_64.rpm && \ | ||
rm -f theia-0.0.1-1.x86_64.rpm | ||
|
||
ENV SHELL /bin/bash | ||
EXPOSE 3000 | ||
CMD ["theia","start","--hostname=0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Theia RPM Build | ||
A demonstration of how to package the [Theia Cloud IDE](https://github.com/theia-ide/theia) into an RPM for easier distribution, using the [speculate](https://www.npmjs.com/package/speculate) module. | ||
|
||
This example uses a [multi-stage build](https://docs.docker.com/develop/develop-images/multistage-build/) design to first build and package Theia into an rpm. The rpm is then transferred to a new image to preserve a clean environment. This process is independent of docker and could be replicated in other build environments (i.e. on localhost). | ||
|
||
## Quickstart | ||
```console | ||
# build rpm | ||
> git clone https://github.com/theia-ide/theia-apps.git | ||
> cd theia-apps/theia-rpm-build-docker | ||
> docker build -t theia-rpm . | ||
|
||
# to verify RPM installation was successful | ||
> docker run -p 3000:3000 -it theia-rpm bash | ||
> theia --help # call Theia CLI directly | ||
> theia start --hostname=0.0.0.0 # start Theia | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "theia", | ||
"version": "0.0.1", | ||
"license": "EPL-2.0", | ||
"engines" : { | ||
"node":"10.x" | ||
}, | ||
"dependencies": { | ||
"@theia/callhierarchy": "latest", | ||
"@theia/file-search": "latest", | ||
"@theia/json": "latest", | ||
"@theia/markers": "latest", | ||
"@theia/merge-conflicts": "latest", | ||
"@theia/messages": "latest", | ||
"@theia/mini-browser": "latest", | ||
"@theia/navigator": "latest", | ||
"@theia/outline-view": "latest", | ||
"@theia/preferences": "latest", | ||
"@theia/preview": "latest", | ||
"@theia/search-in-workspace": "latest", | ||
"@theia/terminal": "latest", | ||
"@theia/textmate-grammars": "latest", | ||
"typescript": "latest" | ||
}, | ||
"devDependencies": { | ||
"@theia/cli": "latest" | ||
}, | ||
"scripts": { | ||
"prebuild": "npm install -g yarn", | ||
"prebuild-rpm": "ln -s \"$( pwd )\" ~/rpmbuild && npm install -g speculate", | ||
"build-rpm": "speculate && rpmbuild -bb SPECS/theia.spec", | ||
"start": "npm run prebuild && yarn theia start" | ||
}, | ||
"spec": { | ||
"rebuild": false, | ||
"prune": false, | ||
"nodeVersion": "> 10.0.0", | ||
"requires": [ | ||
"nodejs", | ||
"python" | ||
], | ||
"executable": [ | ||
"./run_theia.sh" | ||
], | ||
"post": [ | ||
"mv /usr/lib/theia/run_theia.sh /usr/local/bin/theia" | ||
] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
\cd /usr/lib/theia | ||
args=( $@ ) | ||
node src-gen/backend/main.js ${args[*]} | ||
|