Skip to content

Commit

Permalink
Add VSC settings configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
iyannsch committed Jul 29, 2024
1 parent 69f91b2 commit f237360
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 19 deletions.
24 changes: 24 additions & 0 deletions images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,24 +15,47 @@ 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.
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` (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/<name>/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
```
2 changes: 1 addition & 1 deletion images/base-ide/BaseDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions images/base-ide/project/.theia/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extensions.ignoreRecommendations": true,
"files.exclude": {
"**/.theia": true
}
}
13 changes: 8 additions & 5 deletions images/c/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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/
Expand Down
23 changes: 13 additions & 10 deletions images/haskell/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion images/java-17/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions images/ocaml/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
3 changes: 3 additions & 0 deletions images/python/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
7 changes: 5 additions & 2 deletions images/swift/ToolDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit f237360

Please sign in to comment.