enso/tools/ci
Dmitry Bushev 67f075b10d
Optimize runtime Docker image size (#11529)
Reduce the size of the runtime Docker image from `3.04GB` to `1.41GB`.

```
$ docker images
REPOSITORY                   TAG       IMAGE ID       CREATED         SIZE
runtime                      latest    ab76231c78c5   9 minutes ago   1.41GB
<none>                       <none>    c8f70807b04f   4 hours ago     3.04GB
```

The image was bloated because of `RUN chmod` and `RUN chown` commands. When the `RUN` command modifies the file, it copies it to a new layer, resulting in a final image with multiple layers containing the same files.

# Important Notes
Note that copying directories with `COPY --chmod=5xx` sets the executable flag to both files and directories. While it is suboptimal (we only need the executable attribute for directories), having executable files in `/opt/enso` should not be an issue. Permissions can be narrowed further when the new Dockerfile `COPY` syntax is stabilized.
2024-11-12 22:04:46 +00:00
..
artifact-test/repl Migrate the REPL to the New Server (#827) 2020-06-15 13:06:20 +02:00
docker Optimize runtime Docker image size (#11529) 2024-11-12 22:04:46 +00:00
nightly Format TS code (#10648) 2024-07-26 17:47:59 +10:00
releases Format TS code (#10648) 2024-07-26 17:47:59 +10:00
check-changelog.js Format TS code (#10648) 2024-07-26 17:47:59 +10:00
prepare-distribution-env.sh Add Python and R to the GraalVM Bundle (#1644) 2021-04-07 17:19:23 +03:00
README.md Optimize runtime Docker image size (#11529) 2024-11-12 22:04:46 +00:00
Test.enso Move Builtin Types and Methods to stdlib (#3363) 2022-05-05 20:18:06 +02:00

CI Tools

This folder contains miscellaneous utilities for CI.

Docker

Building

A custom docker image requires a certain number of directories to be present from a desired edition. The root directory of the docker build context can be provided in the docker build command:

docker build \
  -t runtime:latest \
  -f tools/ci/docker/Dockerfile \
  --build-context docker-tools=tools/ci/docker \
  built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev

Running

To start Language Server with a default configuration, run the built image and mount the project directory:

docker run -it --rm \
  --network=host \
  --mount type=bind,src=~/Documents/enso-projects/NewProject,dst=/volumes/workspace/project_root \
  runtime:latest

Ydoc NodeJS Docker

Building

To build a NodeJS-based Ydoc, you need to first ensure that you have the distributable sources:

pnpm -r compile

the resulting artifacts are located in app/ydoc-server-nodejs/dist directory. Having the right NodeJS sources in place, one can now build the docker image:

ocker build -t ydoc-server-nodejs:latest -f tools/ci/docker/ydoc-server/Dockerfile --build-context docker-tools=tools/ci/docker/ydoc-server app/ydoc-server-nodejs

Running

One should always start Ydoc with the right configuration:

  • PORT - the port number under which Ydoc will be available
  • HOSTNAME - the hostname under which Ydoc will be available
  • LANGUAGE_SERVER_URL - the full url (with port number) of the language server to connect to
docker run -it -e PORT=1234 -e HOSTNAME='0.0.0.0' -e LANGUAGE_SERVER_URL=ws://localhost:59876 ydoc-server-nodejs:latest

When correctly setup the network layer one can also hit Ydoc's healthcheck endpoint:

> curl http://${HOSTNAME}:${PORT}/_health
OK