2025-07-02 05:27:36 +00:00
FROM node:22.15.1 AS builder
2025-03-03 08:52:24 +00:00
# Fix for JS heap limit allocation issue
ENV NODE_OPTIONS="--max-old-space-size=4096"
2025-07-02 05:27:36 +00:00
RUN npm i -g npm@10.9.2
RUN npm cache clean --force
2025-03-03 08:52:24 +00:00
RUN npm install -g @nestjs/cli
RUN mkdir -p /app
WORKDIR /app
2025-07-02 05:27:36 +00:00
# Set GitHub token and branch as build arguments
2025-03-03 08:52:24 +00:00
ARG CUSTOM_GITHUB_TOKEN
2025-07-02 05:27:36 +00:00
ARG BRANCH_NAME
2025-03-03 08:52:24 +00:00
# Clone and checkout the frontend repository
RUN git config --global url."https://x-access-token:${CUSTOM_GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
RUN git config --global http.version HTTP/1.1
RUN git config --global http.postBuffer 524288000
RUN git clone https://github.com/ToolJet/ToolJet.git .
# The branch name needs to be changed the branch with modularisation in CE repo
2025-07-09 18:11:59 +00:00
RUN git checkout ${BRANCH_NAME}
RUN git submodule update --init --recursive
2025-08-05 05:37:48 +00:00
# Checkout the same branch in submodules if it exists, otherwise fallback to lts-3.16
2025-07-09 13:24:59 +00:00
RUN git submodule foreach " \
if git show-ref --verify --quiet refs/heads/${BRANCH_NAME} || \
git ls-remote --exit-code --heads origin ${BRANCH_NAME}; then \
git checkout ${BRANCH_NAME}; \
else \
2025-08-05 05:37:48 +00:00
echo 'Branch ${BRANCH_NAME} not found in submodule \$name, falling back to lts-3.16'; \
git checkout lts-3.16; \
2025-07-09 13:24:59 +00:00
fi"
2025-03-03 08:52:24 +00:00
2025-07-09 18:11:59 +00:00
# Scripts for building
2025-03-03 08:52:24 +00:00
COPY ./package.json ./package.json
# Building ToolJet plugins
COPY ./plugins/package.json ./plugins/package-lock.json ./plugins/
RUN npm --prefix plugins install
COPY ./plugins/ ./plugins/
ENV NODE_ENV=production
RUN npm --prefix plugins run build
RUN npm --prefix plugins prune --production
2025-07-02 05:27:36 +00:00
ENV TOOLJET_EDITION=cloud
ENV NODE_ENV=production
2025-03-03 08:52:24 +00:00
# Building ToolJet server
COPY ./server/package.json ./server/package-lock.json ./server/
2025-07-03 15:19:15 +00:00
RUN npm --prefix server install
2025-03-03 08:52:24 +00:00
COPY ./server/ ./server/
2025-07-03 15:19:15 +00:00
RUN npm install -g @nestjs/cli
RUN npm install -g copyfiles
2025-03-03 08:52:24 +00:00
RUN npm --prefix server run build
2025-07-02 05:27:36 +00:00
FROM debian:12
2025-03-03 08:52:24 +00:00
RUN apt-get update -yq \
&& apt-get install curl gnupg zip -yq \
&& apt-get install -yq build-essential \
&& apt-get clean -y
2025-07-02 05:27:36 +00:00
RUN curl -O https://nodejs.org/dist/v22.15.1/node-v22.15.1-linux-x64.tar.xz \
&& tar -xf node-v22.15.1-linux-x64.tar.xz \
&& mv node-v22.15.1-linux-x64 /usr/local/lib/nodejs \
2025-03-03 08:52:24 +00:00
&& echo 'export PATH="/usr/local/lib/nodejs/bin:$PATH"' >> /etc/profile.d/nodejs.sh \
&& /bin/bash -c "source /etc/profile.d/nodejs.sh" \
2025-07-02 05:27:36 +00:00
&& rm node-v22.15.1-linux-x64.tar.xz
2025-03-03 08:52:24 +00:00
ENV PATH=/usr/local/lib/nodejs/bin:$PATH
ENV NODE_ENV=production
2025-07-02 05:27:36 +00:00
ENV TOOLJET_EDITION=cloud
2025-03-03 08:52:24 +00:00
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN apt-get update && apt-get install -y postgresql-client freetds-dev libaio1 wget
# Install Instantclient Basic Light Oracle and Dependencies
WORKDIR /opt/oracle
RUN wget https://tooljet-plugins-production.s3.us-east-2.amazonaws.com/marketplace-assets/oracledb/instantclients/instantclient-basiclite-linuxx64.zip && \
wget https://tooljet-plugins-production.s3.us-east-2.amazonaws.com/marketplace-assets/oracledb/instantclients/instantclient-basiclite-linux.x64-11.2.0.4.0.zip && \
unzip instantclient-basiclite-linuxx64.zip && rm -f instantclient-basiclite-linuxx64.zip && \
unzip instantclient-basiclite-linux.x64-11.2.0.4.0.zip && rm -f instantclient-basiclite-linux.x64-11.2.0.4.0.zip && \
cd /opt/oracle/instantclient_21_10 && rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
cd /opt/oracle/instantclient_11_2 && rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
# Set the Instant Client library paths
ENV LD_LIBRARY_PATH="/opt/oracle/instantclient_11_2:/opt/oracle/instantclient_21_10:${LD_LIBRARY_PATH}"
WORKDIR /
RUN mkdir -p /app
# copy npm scripts
COPY --from=builder /app/package.json ./app/package.json
# copy plugins dependencies
COPY --from=builder /app/plugins/dist ./app/plugins/dist
COPY --from=builder /app/plugins/client.js ./app/plugins/client.js
COPY --from=builder /app/plugins/node_modules ./app/plugins/node_modules
COPY --from=builder /app/plugins/packages/common ./app/plugins/packages/common
COPY --from=builder /app/plugins/package.json ./app/plugins/package.json
# copy server build
COPY --from=builder /app/server/package.json ./app/server/package.json
COPY --from=builder /app/server/.version ./app/server/.version
2025-07-03 15:28:10 +00:00
COPY --from=builder /app/server/ee/keys ./app/server/ee/keys
2025-03-03 08:52:24 +00:00
COPY --from=builder /app/server/node_modules ./app/server/node_modules
COPY --from=builder /app/server/templates ./app/server/templates
COPY --from=builder /app/server/scripts ./app/server/scripts
COPY --from=builder /app/server/dist ./app/server/dist
2025-07-09 13:24:59 +00:00
COPY --from=builder --chown=appuser:0 /app/server/ee/ai/assets ./app/server/ee/ai/assets
2025-03-03 08:52:24 +00:00
2025-08-05 06:58:01 +00:00
COPY ./docker/LTS/cloud/cloud-entrypoint.sh ./app/server/cloud-entrypoint.sh
2025-06-05 11:55:35 +00:00
2025-07-16 19:08:42 +00:00
# Installing git for simple git commands
2025-07-17 08:26:36 +00:00
RUN apt-get update && apt-get install -y git openssh-client && apt-get clean
2025-07-16 19:08:42 +00:00
2025-03-03 08:52:24 +00:00
# Define non-sudo user
RUN useradd --create-home --home-dir /home/appuser appuser \
&& chown -R appuser:0 /app \
&& chown -R appuser:0 /home/appuser \
&& chmod u+x /app \
&& chmod -R g=u /app
2025-07-02 05:27:36 +00:00
RUN mkdir -p /home/appuser/.npm/_cacache \
mkdir -p /home/appuser/.npm_cache_tmp \
mkdir -p /home/appuser/.npm/_logs \
&& chown -R appuser:0 /home/appuser/.npm \
&& chmod g+s /home/appuser/.npm_cache_tmp
2025-03-03 08:52:24 +00:00
# Set npm cache directory
2025-07-02 05:27:36 +00:00
RUN npm config set cache /tmp/npm-cache --global
ENV npm_config_cache /tmp/npm-cache
2025-03-03 08:52:24 +00:00
ENV HOME=/home/appuser
2025-06-05 11:55:35 +00:00
2025-07-02 05:27:36 +00:00
# Switch back to appuser
2025-03-03 08:52:24 +00:00
USER appuser
WORKDIR /app
2025-07-16 15:48:55 +00:00
2025-03-03 08:52:24 +00:00
# Dependencies for scripts outside nestjs
RUN npm install dotenv@10.0.0 joi@17.4.1
2025-07-02 05:27:36 +00:00
RUN npm cache clean --force
2025-06-05 11:55:35 +00:00
ENTRYPOINT ["./server/cloud-entrypoint.sh"]