Skip to content

Commit

Permalink
Create better images for C, Haskell, JS, Python, Java, and Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
iyannsch committed Sep 16, 2024
1 parent a82345a commit 7126550
Show file tree
Hide file tree
Showing 11 changed files with 5,767 additions and 22 deletions.
23 changes: 14 additions & 9 deletions images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ We use Theia to provide students with programming environments tailored to their

Matching Artemis' programming environments, the following images are available:

- [x] Java 17
- [x] Kotlin (use Java 17 image and install Kotlin via Maven dependency)
- [x] Python
- [x] C
- [x] Haskell (some plugins require GHCup which is not yet installed)
- [ ] VHDL
- [ ] Assembler
- [x] Swift
- [x] Ocaml
| Name | Available | Language & Auto-Complete |
|-----------|:---------:|:----------------:|
| Java 17 | ✔️ | ✔️ |
| Kotlin | ✔️ | ✔️ |
| Python | ✔️ | ✔️ |
| C | ✔️ | ✔️ |
| Haskell | ✔️ ||
| VHDL |||
| Assembler |||
| Swift | ✔️ | ✔️ |
| Ocaml | ✔️ ||
| Javascript| ✔️ | ✔️ |
| Rust |||


## Structure of Images

Expand Down
2 changes: 1 addition & 1 deletion images/c/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ COPY --from=plugin-image /home/theia/node_modules/ /home/theia/node_modules/

# Install required tools for tool creation and terminal usage: wget, apt-transport-https, update & upgrade packages, bash
RUN apt-get update && \
apt-get install -y wget apt-transport-https bash && \
apt-get install -y wget apt-transport-https bash clangd && \
apt-get upgrade -y

# Specify default shell for Theia and the Built-In plugins directory
Expand Down
19 changes: 10 additions & 9 deletions images/haskell/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,20 @@ COPY images/haskell/stack-config/config.yaml $STACK_ROOT/config.yaml
COPY images/haskell/stack-config/global-project/stack.yaml $STACK_ROOT/global-project/stack.yaml

# Install Haskell dependencies
# build-essentials libffi6
RUN apt-get update \
&& apt-get -y install curl perl tar llvm libnuma-dev \
&& bash -c "curl -sSL https://get.haskellstack.org/ | sh" \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
&& apt-get -y install curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 perl tar llvm libnuma-dev
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*

ENV HOME /home/theia
EXPOSE 3000

# We install stack as the main CLI tool.
# It bundles the creation of new projects (`stack new`), building (`stack build`) and finally running (`stack exec`) Haskell projects.
RUN stack setup && \
stack ghc \
RUN bash -c "curl -sSL https://get.haskellstack.org/ | sh" \
&& stack setup \
&& stack ghc \
--package QuickCheck \
--package quickcheck-assertions \
--package smallcheck \
Expand All @@ -94,9 +98,6 @@ ENV SHELL=/bin/bash \
# Use installed git instead of dugite
ENV USE_LOCAL_GIT true

ENV HOME /home/theia
EXPOSE 3000

# Switch to Theia user
USER theia
WORKDIR /home/theia/applications/browser
Expand Down
83 changes: 83 additions & 0 deletions images/javascript/ToolDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Load the base-ide image, only copy from here
FROM ghcr.io/ls1intum/theia/base as base-ide

# Load the plugin image, only copy from here
FROM node:18-bullseye as plugin-image

WORKDIR /home/theia

# Configure to skip download of puppeteer
ENV PUPPETEER_SKIP_DOWNLOAD true

# Copy required configuration files
COPY yarn.lock yarn.lock

# Copy image specific files - this should overwrite the default files from the repository
COPY images/javascript/package.json .

# 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 --network-timeout 1000000 && \
yarn download:plugins

# Assemble the application
FROM node:18-bullseye-slim as final-ide

WORKDIR /home/theia

# Copy IDE files
COPY --from=base-ide /home/theia/applications/browser/lib/backend /home/theia/applications/browser/lib/backend
COPY --from=base-ide /home/theia/applications/browser/ /home/theia/applications/browser/

# Copy plugins
COPY --from=base-ide /home/theia/plugins /home/theia/plugins
COPY --from=plugin-image /home/theia/plugins /home/theia/plugins

# Create theia user and directories
# Application will be copied to /home/theia
# Default workspace is located at /home/project
RUN adduser --system --group theia --uid 101
RUN chmod g+rw /home && \
mkdir -p /home/project && \
chown -R theia:theia /home/theia && \
chown -R theia:theia /home/project

# Copy the project configuration files
COPY --from=base-ide --chown=theia:theia /home/theia/project /home/project
COPY images/javascript/project /home/project

# Install required tools for tool creation and terminal usage: wget, apt-transport-https, update & upgrade packages, bash
RUN apt-get update && \
apt-get install -y wget apt-transport-https bash git curl && \
apt-get upgrade -y

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

# Use installed git instead of dugite
ENV USE_LOCAL_GIT true

# Switch to Theia user
USER theia
ENV HOME /home/theia

# Install dependencies for this application: Temurin JDK, JDK, Maven
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" \
&& nvm install 20 \
&& npm install -g npm


EXPOSE 3000

WORKDIR /home/theia/applications/browser

# 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" ]
105 changes: 105 additions & 0 deletions images/javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"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": {
"@theia/cli": "1.50.1"
},
"scripts": {
"clean": "lerna run clean && rimraf node_modules",
"build:extensions": "lerna run --scope=\"theia-ide*ext\" build",
"download:plugins": "theia download:plugins --rate-limit=15 --parallel=false --ignore-errors"
},
"theiaPluginsDir": "plugins",
"theiaPlugins": {
"eclipse-theia.builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.88.1/file/eclipse-theia.builtin-extension-pack-1.88.1.vsix",
"js-essentials": "https://open-vsx.org/api/Gydunhn/javascript-essentials/0.1.1/file/Gydunhn.javascript-essentials-0.1.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",
"vscode.bat",
"vscode.clojure",
"vscode.coffeescript",
"vscode.configuration-editing",
"vscode.cpp",
"vscode.csharp",
"vscode.css",
"vscode.css-language-features",
"vscode.dart",
"vscode.debug-auto-launch",
"vscode.debug-server-ready",
"vscode.docker",
"vscode.emmet",
"vscode.fsharp",
"vscode.go",
"vscode.groovy",
"vscode.grunt",
"vscode.gulp",
"vscode.handlebars",
"vscode.hlsl",
"vscode.html",
"vscode.html-language-features",
"vscode.ini",
"vscode.jake",
"vscode.java",
"vscode.julia",
"vscode.latex",
"vscode.less",
"vscode.lua",
"vscode.make",
"vscode.markdown-math",
"vscode.npm",
"vscode.objective-c",
"vscode.perl",
"vscode.php",
"vscode.php-language-features",
"vscode.powershell",
"vscode.pug",
"vscode.python",
"vscode.r",
"vscode.razor",
"vscode.restructuredtext",
"vscode.ruby",
"vscode.rust",
"vscode.scss",
"vscode.shaderlab",
"vscode.shellscript",
"vscode.simple-browser",
"vscode.sql",
"vscode.swift",
"vscode.theme-abyss",
"vscode.theme-defaults",
"vscode.theme-kimbie-dark",
"vscode.theme-monokai",
"vscode.theme-monokai-dimmed",
"vscode.theme-quietlight",
"vscode.theme-red",
"vscode.theme-solarized-dark",
"vscode.theme-solarized-light",
"vscode.theme-tomorrow-night-blue",
"vscode.tunnel-forwarding",
"vscode.theme",
"vscode.vb",
"vscode.vscode-theme-seti"
]
}
37 changes: 37 additions & 0 deletions images/javascript/project/.theia/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extensions.ignoreRecommendations": true,
"files.exclude": {
"**/.theia": true
},
/**
* JavaScript Essentials Config
*/
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"javascript.format.enable": true,
"javascript.format.semicolons": "insert",
"javascript.preferences.quoteStyle": "single",
"eslint.enable": true,
"eslint.codeAction.showDocumentation": {
"enable": true
},
"eslint.codeAction.disableRuleComment": {
"enable": true,
"location": "sameLine"
},
"npm-intellisense.importES6": true,
"npm-intellisense.importQuotes": "'",
"npm-intellisense.importLinebreak": ";\r\n",
"npm-intellisense.importDeclarationType": "const",
/**
* The following line is for the specific configuration of the
* Path-Intellisense extension over Javascript
*/
"javascript.suggest.paths": false,
"path-intellisense.showHiddenFiles": true,
"formattingToggle.affects": [
"editor.formatOnPaste",
"editor.formatOnType"
]
}
Loading

0 comments on commit 7126550

Please sign in to comment.