From 6377aa69ee94c5f87a78de0d739dd3d5666f203b Mon Sep 17 00:00:00 2001 From: Harmen Wessels Date: Thu, 7 Nov 2024 01:23:20 +0100 Subject: [PATCH] Updated ubuntu Dockerfile. --- Dockerfile | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9528f0f..0626324 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,7 @@ RUN apt-get update \ libxkbfile-dev \ make \ python3 \ - build-essential \ - git + build-essential # Set the working directory WORKDIR /home/crossmodel @@ -32,16 +31,29 @@ RUN yarn --pure-lockfile --skip-integrity-check --network-timeout 100000 && \ echo *.spec.* >> .yarnclean && \ yarn autoclean --force && \ yarn cache clean && \ - rm -rf .devcontainer .git .github .vscode applications/electron-app docs e2e-tests + rm -rf .devcontainer .git .github .vscode applications/electron-app docs e2e-tests examples # Stage 2: Production stage, using a slim image FROM node:20-bookworm-slim AS production-stage # Create a non-root user with a fixed user id and setup the environment +# Default workspace is located at /home/project RUN adduser --system --group crossmodel && \ chmod g+rw /home && \ - mkdir -p /home/crossmodel && \ + mkdir -p /home/project && \ chown -R crossmodel:crossmodel /home/crossmodel + +# Install required tools for application: Git, SSH, Bash +# Node is already available in base image +RUN apt-get install -y git openssh-client openssh-server bash libsecret-1-0 && \ + apt-get clean + +# Copy the mapping example workspace into the project folder. +COPY examples/mapping-example /home/project + +# Set the permission of the project folder. +RUN chown -R crossmodel:crossmodel /home/project + ENV HOME=/home/crossmodel WORKDIR /home/crossmodel @@ -51,6 +63,13 @@ COPY --from=build-stage --chown=crossmodel:crossmodel /home/crossmodel /home/cro # Expose the default CrossModel port EXPOSE 3000 +# Specify default shell for Theia and the Built-In plugins directory +ENV SHELL=/bin/bash \ + THEIA_DEFAULT_PLUGINS=local-dir:/home/theia/plugins + +# Use installed git instead of dugite +ENV USE_LOCAL_GIT true + # Use the non-root user USER crossmodel @@ -59,4 +78,6 @@ WORKDIR /home/crossmodel/applications/browser-app # Start the application ENTRYPOINT ["node", "/home/crossmodel/applications/browser-app/lib/backend/main.js"] -CMD ["--hostname=0.0.0.0"] \ No newline at end of file + +# Arguments passed to the application +CMD [ "/home/project", "--hostname=0.0.0.0"] \ No newline at end of file