Skip to content

Commit

Permalink
Minor cleanups to docker image (#8925)
Browse files Browse the repository at this point in the history
* Minor cleanups to docker image

* format

* nit
  • Loading branch information
hubertp authored Feb 11, 2024
1 parent aed59d3 commit b00dc9e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Cargo.toml
/distribution/ @4e6 @jdunkerley @radeusgd @GregoryTravis @AdRiley
/engine/ @4e6 @jaroslavtulach @hubertp @Akirathan
/project/ @4e6 @jaroslavtulach @hubertp
/tools/ @4e6 @jaroslavtulach @radeusgd
/tools/ @4e6 @jaroslavtulach @radeusgd @hubertp

# Enso Libraries
# This section should be amended once the engine moves to /app/engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class LanguageServerComponent(config: LanguageServerConfig, logLevel: Level)
}
_ <- Future {
logger.info(
s"Started server at json:${config.interface}${config.rpcPort}, ${config.secureRpcPort
s"Started server at json:${config.interface}:${config.rpcPort}, ${config.secureRpcPort
.map(p => s"secure-jsons:${config.interface}$p")
.getOrElse("")}, " +
s"binary:${config.interface}:${config.dataPort}${config.secureDataPort
Expand Down
23 changes: 23 additions & 0 deletions tools/ci/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# 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:

```bash
docker build -t <my-custom-name> -f tools/ci/docker/DockerFile --build-context docker-tools=tools/ci/docker built-distribution/enso-engine-$VERSION-linux-amd64/enso-$VERSION
```

where for a locally built distribution on Linux it would be `VERSION=0.0.0-dev`.

## Running

To start Language Server with a default configuration simply run the built image
with the chosen name:

```bash
docker run -t <my-custom-name>
```
19 changes: 15 additions & 4 deletions tools/ci/docker/Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ FROM ghcr.io/graalvm/jdk-community:21

USER root

ENV LOG_LEVEL=INFO
ARG LOG_LEVEL=info
ARG RPC_PORT=30001
ARG DATA_PORT=30002
ARG PRINT_VERSION=0
ARG JAVA_OPTS="-XX:MaxRAMPercentage=90.0 -XX:InitialRAMPercentage=90.0"

RUN useradd -u 2000 -c 'Enso Developer' -U -m ensodev

Expand Down Expand Up @@ -39,14 +43,21 @@ RUN chmod a+rw /opt/enso/logs
RUN mkdir -p /volumes
RUN chown -hR ensodev:ensodev /volumes
RUN chmod -R u=rwX,g=rwX /volumes
COPY --from=docker-tools docker-entrypoint.sh /opt/enso/bin/

USER ensodev:ensodev

WORKDIR /opt/enso

ENTRYPOINT [ "/opt/enso/bin/docker-entrypoint.sh" ]

EXPOSE 30001
EXPOSE 30002
ENV RPC_PORT=${RPC_PORT}
ENV DATA_PORT=${DATA_PORT}
ENV LOG_LEVEL=${LOG_LEVEL}
ENV PRINT_VERSION=${PRINT_VERSION}
ENV JAVA_OPTS=${JAVA_OPTS}

CMD ["--server", "--daemon", "--rpc-port", "30001", "--data-port", "30002", "--root-id", "00000000-0000-0000-0000-000000000001", "--path", "/volumes/workspace/project_root", "--interface", "0.0.0.0"]
EXPOSE ${RPC_PORT}
EXPOSE ${DATA_PORT}

CMD ["--server", "--daemon", "--path", "/volumes/workspace/project_root"]
14 changes: 11 additions & 3 deletions tools/ci/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash
set -e

echo "Starting Enso Runtime in version"
if [ "$PRINT_VERSION" == "1" ]; then
/opt/enso/bin/enso --version
fi

/opt/enso/bin/enso --version
if [ "$LS_ROOT_ID" == "" ]; then
LS_ROOT_ID="00000000-0000-0000-0000-000000000001"
fi

/opt/enso/bin/enso --log-level $LOG_LEVEL "$@"
if [ "$INTERFACE" == "" ]; then
INTERFACE="0.0.0.0"
fi

/opt/enso/bin/enso --log-level "$LOG_LEVEL" --rpc-port $RPC_PORT --data-port $DATA_PORT --root-id "$LS_ROOT_ID" --interface "$INTERFACE" "$@"

0 comments on commit b00dc9e

Please sign in to comment.