diff --git a/images/README.md b/images/README.md index da36c5887..33a132ee3 100644 --- a/images/README.md +++ b/images/README.md @@ -3,6 +3,7 @@ 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. 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 @@ -14,6 +15,7 @@ Matching Artemis' programming environments, the following images are available: - [x] Ocaml ## 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. @@ -21,17 +23,39 @@ Our used Theia IDE Images are built in 3 steps 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` (implemented in the ToolDockerfile) ## 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 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. +Similar to VSC, Theia IDE also supports to set configuration values using a `settings.json`. The `images/base-ide/project` folder will be mounted at `/home/project` inside the final image and, thus, will load the configuration values during startup. + ## Choosing the correct plugins + Plugins are an easy way to add functionality to the basic features of VSC or the minimal `base-ide` image. To configure the download step of the `plugin-image` (currently incorporated in the `ToolDockerfile`), you may change the `theiaPlugins` array of the `package.json` inside of your image's folder (`/images//package.json`). Why donĀ“t you start finding appropriate plugins [here](https://open-vsx.org/)? ### Configuring Theia's VSC built-ins + Theia offers a large built-in plugin bundling all those (82) functions and languages that VSC offers out of the box (https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.88.1/file/eclipse-theia.builtin-extension-pack-1.88.1.vsix). As your image most likely will not require all those features, you can remove sub-plugins by adding their `id` to the list of `theiaPluginsExcludeIds` of the `package.json`. You can find the list of all excluded plugins in the `/images/base-ide/package.json`. + +## Testing blueprints locally + +To test images locally, they need to be pulled from ghcr.io. You can also built them yourself by starting with the BaseImage and follow with the respective ToolImage afterwards. + +``` +docker build -t ghcr.io/ls1intum/theia/base-ide -f images/base-ide/BaseDockerfile . + +docker build -t ghcr.io/ls1intum/theia/java-17 -f images/java-17/ToolDockerfile . +``` + +When finally starting the container, remember that Theia utilizes port 3000. You may use the following command to start the Java17 image. + +``` +docker run --rm --name theia -p 3000:3000 ghcr.io/ls1intum/theia/java-17 +``` diff --git a/images/base-ide/BaseDockerfile b/images/base-ide/BaseDockerfile index 513b5a2cf..add698e6c 100644 --- a/images/base-ide/BaseDockerfile +++ b/images/base-ide/BaseDockerfile @@ -23,7 +23,7 @@ COPY applications applications # Copy Theia Extensions (launcher, product, updater) COPY theia-extensions theia-extensions -# Copy image specific files - this should overwrite the default files from the repository +# Copy base image files for installing and building Theia as well as configuring the IDE COPY images/base-ide/ . # Remove unnecesarry files for the browser application diff --git a/images/base-ide/project/.theia/settings.json b/images/base-ide/project/.theia/settings.json new file mode 100644 index 000000000..a812acf1e --- /dev/null +++ b/images/base-ide/project/.theia/settings.json @@ -0,0 +1,6 @@ +{ + "extensions.ignoreRecommendations": true, + "files.exclude": { + "**/.theia": true + } +} \ No newline at end of file diff --git a/images/c/ToolDockerfile b/images/c/ToolDockerfile index 333d01241..2ceed8f88 100644 --- a/images/c/ToolDockerfile +++ b/images/c/ToolDockerfile @@ -28,11 +28,11 @@ FROM ubuntu:23.04 as final-ide # Make sure all sources are up to date RUN apt update && \ - apt upgrade -y --autoremove && \ - apt install -y --no-install-recommends \ - gcc clang git gdb make \ - findutils bzip2 e2fsprogs sudo adduser && \ - apt clean && rm -rf /var/lib/apt/lists/* + apt upgrade -y --autoremove && \ + apt install -y --no-install-recommends \ + gcc clang git gdb make \ + findutils bzip2 e2fsprogs sudo adduser && \ + apt clean && rm -rf /var/lib/apt/lists/* WORKDIR /home/theia @@ -53,6 +53,9 @@ RUN chmod g+rw /home && \ 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 node from plugin-image as it is required for Theia COPY --from=plugin-image /usr/local/bin/node /usr/local/bin/ COPY --from=plugin-image /usr/local/lib/node_modules/ /usr/local/lib/node_modules/ diff --git a/images/haskell/ToolDockerfile b/images/haskell/ToolDockerfile index 7f9dd87d9..d990b22a6 100644 --- a/images/haskell/ToolDockerfile +++ b/images/haskell/ToolDockerfile @@ -44,6 +44,9 @@ RUN chmod g+rw /home && \ 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 node from plugin-image as it is required for Theia COPY --from=plugin-image /usr/local/bin/node /usr/local/bin/ COPY --from=plugin-image /usr/local/lib/node_modules/ /usr/local/lib/node_modules/ @@ -72,16 +75,16 @@ RUN apt-get update \ # It bundles the creation of new projects (`stack new`), building (`stack build`) and finally running (`stack exec`) Haskell projects. RUN stack setup && \ stack ghc \ - --package QuickCheck \ - --package quickcheck-assertions \ - --package smallcheck \ - --package tasty \ - --package tasty-ant-xml \ - --package tasty-hunit \ - --package tasty-quickcheck \ - --package tasty-smallcheck \ - --package unordered-containers \ - -- --version \ + --package QuickCheck \ + --package quickcheck-assertions \ + --package smallcheck \ + --package tasty \ + --package tasty-ant-xml \ + --package tasty-hunit \ + --package tasty-quickcheck \ + --package tasty-smallcheck \ + --package unordered-containers \ + -- --version \ && chmod -R a+rw $STACK_ROOT # Specify default shell for Theia and the Built-In plugins directory diff --git a/images/java-17/ToolDockerfile b/images/java-17/ToolDockerfile index 098fc21dc..ac4c179c1 100644 --- a/images/java-17/ToolDockerfile +++ b/images/java-17/ToolDockerfile @@ -43,9 +43,12 @@ RUN chmod g+rw /home && \ 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 + # 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 git && \ apt-get upgrade -y # Install dependencies for this application: Temurin JDK, JDK, Maven diff --git a/images/ocaml/ToolDockerfile b/images/ocaml/ToolDockerfile index 55c97ba9c..e188cf8db 100644 --- a/images/ocaml/ToolDockerfile +++ b/images/ocaml/ToolDockerfile @@ -52,6 +52,9 @@ RUN chmod g+rw /home && \ chown -R theia:theia /home/project ENV HOME /home/theia +# Copy the project configuration files +COPY --from=base-ide --chown=theia:theia /home/theia/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 && \ diff --git a/images/python/ToolDockerfile b/images/python/ToolDockerfile index da424cb6d..29d651171 100644 --- a/images/python/ToolDockerfile +++ b/images/python/ToolDockerfile @@ -50,6 +50,9 @@ RUN chmod g+rw /home && \ 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 node from plugin-image as it is required for Theia COPY --from=plugin-image /usr/local/bin/node /usr/local/bin/ COPY --from=plugin-image /usr/local/lib/node_modules/ /usr/local/lib/node_modules/ diff --git a/images/swift/ToolDockerfile b/images/swift/ToolDockerfile index 7ba2bf595..8253aa615 100644 --- a/images/swift/ToolDockerfile +++ b/images/swift/ToolDockerfile @@ -33,7 +33,7 @@ FROM ${BUILDER_IMAGE} as builder RUN apt-get update && apt-get install -y \ libcurl4-openssl-dev \ libxml2-dev \ - && rm -r /var/lib/apt/lists/* + && rm -r /var/lib/apt/lists/* RUN git clone https://github.com/realm/SwiftLint.git WORKDIR /SwiftLint @@ -55,7 +55,7 @@ FROM ${RUNTIME_IMAGE} as final-ide RUN apt-get update && apt-get install -y \ libcurl4 \ libxml2 \ - && rm -r /var/lib/apt/lists/* + && rm -r /var/lib/apt/lists/* WORKDIR /home/theia @@ -76,6 +76,9 @@ RUN chmod g+rw /home && \ 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 dependencies from builder image COPY --from=builder /usr/lib/libsourcekitdInProc.so /usr/lib COPY --from=builder /usr/lib/swift/linux/libBlocksRuntime.so /usr/lib