Skip to content

Commit

Permalink
Updated ubuntu Dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
harmen-xb committed Nov 7, 2024
1 parent d579816 commit 6377aa6
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ RUN apt-get update \
libxkbfile-dev \
make \
python3 \
build-essential \
git
build-essential

# Set the working directory
WORKDIR /home/crossmodel
Expand All @@ -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

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

Expand All @@ -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"]

# Arguments passed to the application
CMD [ "/home/project", "--hostname=0.0.0.0"]

0 comments on commit 6377aa6

Please sign in to comment.