mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 16:11:45 +03:00
Dockerize NodeJS-based Ydoc (#10811)
Initial image for Ydoc, along with instructions. Closes #10751.
This commit is contained in:
parent
e836373d9b
commit
a168baddb3
@ -24,3 +24,42 @@ with the chosen name:
|
||||
```bash
|
||||
docker run -t <my-custom-name>
|
||||
```
|
||||
|
||||
# Ydoc NodeJS Docker
|
||||
|
||||
## Building
|
||||
|
||||
To build a NodeJS-based Ydoc, you need to first ensure that you have the
|
||||
distributable sources:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
> curl http://${HOSTNAME}:${PORT}/_health
|
||||
OK
|
||||
```
|
||||
|
39
tools/ci/docker/ydoc-server/Dockerfile
Normal file
39
tools/ci/docker/ydoc-server/Dockerfile
Normal file
@ -0,0 +1,39 @@
|
||||
FROM node:20.16-bookworm-slim
|
||||
|
||||
USER root
|
||||
|
||||
ARG LOG_LEVEL=info
|
||||
ARG YDOC_SERVER_PORT=5976
|
||||
ARG YDOC_SERVER_HOSTNAME=localhost
|
||||
ARG YDOC_SERVER_LANGUAGE_SERVER_URL
|
||||
ARG YDOC_SERVER_DEBUG=false
|
||||
|
||||
RUN useradd -u 2000 -c 'Enso Developer' -U -m ensodev
|
||||
|
||||
RUN mkdir /opt/ydoc-server-nodejs
|
||||
RUN mkdir /opt/ydoc-server-nodejs/logs
|
||||
RUN mkdir /opt/ydoc-server-nodejs/bin
|
||||
|
||||
ADD dist/* /opt/ydoc-server-nodejs
|
||||
|
||||
COPY --from=docker-tools ydoc-server-entrypoint.sh /opt/ydoc-server-nodejs/bin/
|
||||
|
||||
RUN chown -hR ensodev:ensodev /opt/ydoc-server-nodejs
|
||||
RUN chmod -R u=rX,g=rX /opt/ydoc-server-nodejs
|
||||
RUN chmod a+rw /opt/ydoc-server-nodejs/logs
|
||||
RUN chmod a+rw /opt/ydoc-server-nodejs/logs
|
||||
RUN chmod a+x /opt/ydoc-server-nodejs/bin/*
|
||||
|
||||
USER ensodev:ensodev
|
||||
|
||||
WORKDIR /opt/ydoc-server-nodejs
|
||||
|
||||
ENTRYPOINT [ "/opt/ydoc-server-nodejs/bin/ydoc-server-entrypoint.sh" ]
|
||||
|
||||
ENV LOG_LEVEL=${LOG_LEVEL}
|
||||
ENV PORT=${YDOC_SERVER_PORT}
|
||||
ENV HOSTNAME=${YDOC_SERVER_HOSTNAME}
|
||||
ENV LANGUAGE_SERVER_URL=${YDOC_SERVER_LANGUAGE_SERVER_URL}
|
||||
ENV ENSO_YDOC_LS_DEBUG=${YDOC_SERVER_DEBUG}
|
||||
|
||||
EXPOSE ${PORT}
|
4
tools/ci/docker/ydoc-server/ydoc-server-entrypoint.sh
Executable file
4
tools/ci/docker/ydoc-server/ydoc-server-entrypoint.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
node main.mjs "$@"
|
Loading…
Reference in New Issue
Block a user