Skip to content

Commit

Permalink
Add base-ide image and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iyannsch committed Jun 17, 2024
1 parent 1dcf443 commit 2c4ccc9
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 191 deletions.
86 changes: 16 additions & 70 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,24 @@
name: Build, package and test

on:
push:
pull_request:
branches:
- master
workflow_dispatch:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 4 * * *' # Runs every day at 4am: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule


jobs:

build:
name: ${{ matrix.os }}, Node.js v${{ matrix.node }}

build-and-push:
strategy:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-latest, macos-11]
node: ['20.x']

runs-on: ${{ matrix.os }}
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # To fetch all history for all branches and tags. (Will be required for caching with lerna: https://github.com/markuplint/markuplint/pull/111)

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'

- name: Use Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.10.8'

- name: Build and package
shell: bash
run: |
yarn --skip-integrity-check --network-timeout 100000
yarn build:dev
yarn download:plugins
yarn package:applications:preview
env:
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Test (Linux)
if: matrix.tests != 'skip' && runner.os == 'Linux'
uses: GabrielBB/xvfb-action@v1
with:
run: yarn electron test

- name: Test (Windows)
if: matrix.tests != 'skip' && runner.os == 'Windows'
shell: bash
run: |
yarn electron test
- name: Test (macOS)
if: matrix.tests != 'skip' && runner.os == 'macOS'
shell: bash
run: |
yarn electron test
- name: Lint
if: matrix.tests != 'skip'
shell: bash
run: |
yarn lint
docker-context: ['.']
include:
- docker-file: BaseDockerfile
image-name: ghcr.io/ls1intum/theia/base
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@main
with:
docker-file: ${{ matrix.docker-file }}
image-name: ${{ matrix.image-name }}
docker-context: ${{ matrix.docker-context }}
secrets: inherit


52 changes: 0 additions & 52 deletions .github/workflows/license-check-workflow.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/publish-builder-img.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/publish-theia-ide-img.yml

This file was deleted.

21 changes: 21 additions & 0 deletions images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Artemis Theia IDE Images

We use Theia to provide students with programming environments tailored to their course`s needs. Instructors can choose a fitting Theia Blueprint (=Theia IDE Image) in Artemis. This repository contains the build tooling for creating those images.

## Structure of Images
Our used Theia IDE Images are built in 3 steps

1. The `ide-image` builds the Theia Application, downloads all essential plugins and performs cleanup.
2. The `plugin-image` downloads required plugins for each specific programming environment (e.g., linter plugins for Java)
3. The `tool-image` downloads and installs necessary compilers and tools for each programming environment and contains Node.js to launch Theia

## Building Dockerfiles for Images
1. Start with the `tool-image`
2. Copy the built Theia Application with plugins from the `ide-image`
3. Copy the downloaded plugins from the `plugin-image`

## Creating Images
For overwriting default Theia configuration files, a simple directory can be created inside the image`s location. Using a `COPY` instruction in the Dockerfile, all contents will overwrite existing files in the image.

For example, for the image `images/base-ide/`, there is a `package.json`. Using `COPY images/base-ide/ .` in the Dockerfile, it will replace the default `package.json` of Theia. Creating more files in sub-directories (`images/base-ide/test/test.json`) will also overwrite existing files recursively.

61 changes: 61 additions & 0 deletions images/base-ide/BaseIDEDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Builder stage
FROM node:18-bullseye as base-ide

# install required tools to build the application
RUN apt-get update && apt-get install -y libxkbfile-dev libsecret-1-dev

WORKDIR /home/theia

# Copy required configuration files
COPY yarn.lock yarn.lock
COPY package.json package.json
COPY tsconfig.json tsconfig.json
COPY lerna.json lerna.json
COPY configs configs

# Copy Browser Application (do not copy electron application)
COPY applications applications

# Copy Theia Extensions (launcher, product, updater)
COPY theia-extensions theia-extensions

# Copy repository files
#COPY . .

# Copy image specific files - this should overwrite the default files from the repository
COPY images/base-ide/ .

# Remove unnecesarry files for the browser application
# Download plugins and build application production mode
# Use yarn autoclean to remove unnecessary files from package dependencies
RUN yarn --pure-lockfile && \
yarn build:extensions && \
yarn download:plugins && \
yarn browser build
# yarn && \
# yarn autoclean --init && \
# echo *.ts >> .yarnclean && \
# echo *.ts.map >> .yarnclean && \
# echo *.spec.* >> .yarnclean && \
# yarn autoclean --force && \
# yarn cache clean && \
# rm -r .git applications/electron theia-extensions/launcher theia-extensions/updater node_modules

# Fix Debian Bullseye Signatures
RUN apt-get update && apt-get install -y wget apt-transport-https && \
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /usr/share/keyrings/adoptium.asc && \
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list

ENV HOME /home/theia

# Specify default shell for Theia and the Built-In plugins directory
ENV SHELL=/bin/bash \
THEIA_DEFAULT_PLUGINS=local-dir:/home/theia/plugins

EXPOSE 3000

# Launch the backend application via node
ENTRYPOINT [ "node", "/home/theia/applications/browser/lib/backend/main.js" ]

# Arguments passed to the application
CMD [ "/home/project", "--hostname=0.0.0.0" ]
85 changes: 85 additions & 0 deletions images/base-ide/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"private": true,
"version": "1.50.100",
"license": "MIT",
"author": "Rob Moran <[email protected]>",
"homepage": "https://github.com/eclipse-theia/theia-blueprint#readme",
"bugs": {
"url": "https://github.com/eclipse-theia/theia/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eclipse-theia/theia-blueprint.git"
},
"engines": {
"yarn": ">=1.7.0 <2",
"node": ">=12.14.1"
},
"devDependencies": {
"@eclipse-dash/nodejs-wrapper": "^0.0.1",
"@theia/cli": "1.50.1",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/eslint-plugin-tslint": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"eslint": "^7.27.0",
"eslint-plugin-deprecation": "1.2.1",
"eslint-plugin-import": "^2.23.3",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-no-unsanitized": "^3.1.5",
"eslint-plugin-react": "^7.23.2",
"lerna": "^6.0.1",
"rimraf": "^2.7.1",
"ts-node": "^10.0.0",
"type-fest": "^0.20.2",
"yargs": "17.2.1"
},
"scripts": {
"clean": "lerna run clean && rimraf node_modules",
"build": "yarn build:extensions && yarn build:applications",
"build:dev": "yarn build:extensions && yarn build:applications:dev",
"build:applications": "yarn build:extensions && lerna run --scope=\"theia-ide*app\" build:prod --concurrency 1",
"build:applications:dev": "yarn build:extensions && lerna run --scope=\"theia-ide*app\" build --concurrency 1",
"build:extensions": "lerna run --scope=\"theia-ide*ext\" build",
"download:plugins": "theia download:plugins --rate-limit=15 --parallel=false --ignore-errors",
"package:applications": "lerna run --scope=\"theia-ide*app\" package --concurrency 1",
"package:applications:preview": "lerna run --scope=\"theia-ide*app\" package:preview --concurrency 1",
"package:applications:prod": "lerna run --scope=\"theia-ide*app\" package:prod --concurrency 1",
"watch": "lerna run --parallel watch",
"test": "lerna run test",
"electron": "yarn --cwd applications/electron",
"browser": "yarn --cwd applications/browser",
"update:theia": "ts-node scripts/update-theia-version.ts",
"update:theia:children": "lerna run update:theia -- ",
"update:next": "ts-node scripts/update-theia-version.ts next && lerna run update:next",
"lint": "eslint --ext js,jsx,ts,tsx scripts && lerna run lint",
"lint:fix": "eslint --ext js,jsx,ts,tsx scripts --fix && lerna run lint:fix",
"license:check": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json",
"license:check:review": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json --review",
"postinstall": "theia-patch"
},
"theiaPluginsDir": "plugins",
"theiaPlugins": {
"test": "https://open-vsx.org/api/vscode/json/1.88.1/file/vscode.json-1.88.1.vsix"
},
"theiaPluginsExcludeIds": [
"ms-vscode.js-debug-companion",
"VisualStudioExptTeam.vscodeintellicode",
"vscode.builtin-notebook-renderers",
"vscode.extension-editing",
"vscode.github",
"vscode.github-authentication",
"vscode.ipynb",
"vscode.microsoft-authentication"
],
"workspaces": [
"applications/*",
"theia-extensions/*"
],
"resolutions": {
"@types/puppeteer": "^5.4.0",
"@yarnpkg/parsers": "3.0.0-rc.44",
"**/multer": "1.4.4-lts.1",
"**/nan": "2.18.0",
"**/cpu-features": "0.0.9"
}
}

0 comments on commit 2c4ccc9

Please sign in to comment.