2025-06-17 07:31:46 +00:00
FROM node:22.15.1 AS builder
2025-02-25 07:05:17 +00:00
# Fix for JS heap limit allocation issue
2025-02-26 06:06:38 +00:00
ENV NODE_OPTIONS="--max-old-space-size=4096"
2025-02-25 07:05:17 +00:00
2025-06-30 14:08:44 +00:00
RUN npm i -g npm@10.9.2 && npm cache clean --force
2025-02-25 07:05:17 +00:00
2025-06-30 14:08:44 +00:00
RUN mkdir -p /app
2025-02-25 07:05:17 +00:00
WORKDIR /app
# Set GitHub token and branch as build arguments
ARG CUSTOM_GITHUB_TOKEN
2025-06-30 14:08:44 +00:00
ARG BRANCH_NAME
2025-02-25 07:05:17 +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-06-30 15:05:12 +00:00
RUN git checkout ${BRANCH_NAME}
2025-02-25 07:05:17 +00:00
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 12:57:43 +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 12:57:43 +00:00
fi"
2025-02-25 07:05:17 +00:00
# Scripts for building
COPY ./package.json ./package.json
# Build plugins
COPY ./plugins/package.json ./plugins/package-lock.json ./plugins/
2025-06-30 14:08:44 +00:00
RUN npm --prefix plugins ci --omit=dev
2025-02-25 07:05:17 +00:00
COPY ./plugins/ ./plugins/
2025-07-02 12:05:53 +00:00
RUN NODE_ENV=production npm --prefix plugins run build && npm --prefix plugins prune --omit=dev
2025-02-25 07:05:17 +00:00
2025-07-02 07:05:22 +00:00
ENV TOOLJET_EDITION=ee
2025-02-25 07:05:17 +00:00
# Build frontend
COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
RUN npm --prefix frontend install
COPY ./frontend/ ./frontend/
2025-06-30 14:08:44 +00:00
RUN npm --prefix frontend run build --production && npm --prefix frontend prune --production
2025-02-25 07:05:17 +00:00
ENV NODE_ENV=production
2025-07-02 07:05:22 +00:00
ENV TOOLJET_EDITION=ee
2025-02-25 07:05:17 +00:00
# Build server
COPY ./server/package.json ./server/package-lock.json ./server/
2025-06-30 14:08:44 +00:00
RUN npm --prefix server ci --omit=dev
2025-02-25 07:05:17 +00:00
COPY ./server/ ./server/
2025-07-02 12:05:53 +00:00
RUN npm install -g @nestjs/cli && npm install -g copyfiles
RUN npm --prefix server run build && npm prune --production --prefix server
2025-02-25 07:05:17 +00:00
2025-07-02 12:05:53 +00:00
# Install dependencies for PostgREST, curl, tar, etc.
2025-06-30 14:08:44 +00:00
RUN apt-get update && apt-get install -y \
2025-07-02 12:05:53 +00:00
curl ca-certificates tar \
2025-06-30 14:08:44 +00:00
&& rm -rf /var/lib/apt/lists/*
2025-02-25 07:05:17 +00:00
2025-06-30 14:08:44 +00:00
ENV POSTGREST_VERSION=v12.2.0
2025-02-25 07:05:17 +00:00
2025-06-30 14:08:44 +00:00
RUN curl -Lo postgrest.tar.xz https://github.com/PostgREST/postgrest/releases/download/${POSTGREST_VERSION}/postgrest-v12.2.0-linux-static-x64.tar.xz && \
tar -xf postgrest.tar.xz && \
mv postgrest /postgrest && \
rm postgrest.tar.xz && \
chmod +x /postgrest
FROM debian:12-slim
2025-03-18 05:41:49 +00:00
2025-06-30 14:08:44 +00:00
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
wget \
gnupg \
unzip \
ca-certificates \
xz-utils \
tar \
postgresql-client \
redis \
libaio1 \
git \
2025-07-17 08:26:36 +00:00
openssh-client \
2025-06-30 14:08:44 +00:00
freetds-dev \
&& apt-get upgrade -y -o Dpkg::Options::="--force-confold" \
&& apt-get autoremove -y \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2025-03-18 05:41:49 +00:00
2025-02-25 07:05:17 +00:00
2025-06-17 07:31:46 +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-02-25 07:05:17 +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-06-17 07:31:46 +00:00
&& rm node-v22.15.1-linux-x64.tar.xz
2025-02-25 07:05:17 +00:00
ENV PATH=/usr/local/lib/nodejs/bin:$PATH
ENV NODE_ENV=production
2025-02-25 12:28:43 +00:00
ENV TOOLJET_EDITION=ee
2025-02-25 07:05:17 +00:00
ENV NODE_OPTIONS="--max-old-space-size=4096"
2025-06-30 14:08:44 +00:00
# Install Neo4j + APOC
2025-06-05 11:55:35 +00:00
RUN wget -O - https://debian.neo4j.com/neotechnology.gpg.key | apt-key add - && \
echo "deb https://debian.neo4j.com stable 5" > /etc/apt/sources.list.d/neo4j.list && \
2025-06-30 14:08:44 +00:00
apt-get update && apt-get install -y neo4j=1:5.26.6 && apt-mark hold neo4j && \
mkdir -p /var/lib/neo4j/plugins && \
2025-06-05 11:55:35 +00:00
wget -P /var/lib/neo4j/plugins https://github.com/neo4j/apoc/releases/download/5.26.6/apoc-5.26.6-core.jar && \
2025-06-30 14:08:44 +00:00
echo "dbms.security.procedures.unrestricted=apoc.*" >> /etc/neo4j/neo4j.conf && \
2025-06-05 11:55:35 +00:00
echo "dbms.security.procedures.allowlist=apoc.*,algo.*,gds.*" >> /etc/neo4j/neo4j.conf && \
2025-06-30 14:08:44 +00:00
echo "dbms.directories.plugins=/var/lib/neo4j/plugins" >> /etc/neo4j/neo4j.conf && \
echo "dbms.security.auth_enabled=true" >> /etc/neo4j/neo4j.conf && \
apt-get clean && rm -rf /var/lib/apt/lists/*
2025-06-05 11:55:35 +00:00
2025-02-25 07:05:17 +00:00
# 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}"
2025-06-30 14:08:44 +00:00
RUN rm -f *.zip *.key && apt-get clean && rm -rf /var/lib/apt/lists/*
2025-02-25 07:05:17 +00:00
WORKDIR /
RUN mkdir -p /app
2025-06-30 14:08:44 +00:00
RUN useradd --create-home --home-dir /home/appuser appuser
# Use the PostgREST binary from the builder stage
COPY --from=builder --chown=appuser:0 /postgrest /usr/local/bin/postgrest
RUN mv /usr/local/bin/postgrest /usr/local/bin/postgrest-original && \
echo '#!/bin/bash\nexec /usr/local/bin/postgrest-original "$@" 2>&1 | sed "s/^/[PostgREST] /"' > /usr/local/bin/postgrest && \
chmod +x /usr/local/bin/postgrest
# Copy application with ownership set directly to avoid chown -R
COPY --from=builder --chown=appuser:0 /app/package.json ./app/package.json
COPY --from=builder --chown=appuser:0 /app/plugins/dist ./app/plugins/dist
COPY --from=builder --chown=appuser:0 /app/plugins/client.js ./app/plugins/client.js
COPY --from=builder --chown=appuser:0 /app/plugins/node_modules ./app/plugins/node_modules
COPY --from=builder --chown=appuser:0 /app/plugins/packages/common ./app/plugins/packages/common
COPY --from=builder --chown=appuser:0 /app/plugins/package.json ./app/plugins/package.json
COPY --from=builder --chown=appuser:0 /app/frontend/build ./app/frontend/build
COPY --from=builder --chown=appuser:0 /app/server/package.json ./app/server/package.json
COPY --from=builder --chown=appuser:0 /app/server/.version ./app/server/.version
COPY --from=builder --chown=appuser:0 /app/server/ee/keys ./app/server/ee/keys
COPY --from=builder --chown=appuser:0 /app/server/node_modules ./app/server/node_modules
COPY --from=builder --chown=appuser:0 /app/server/templates ./app/server/templates
COPY --from=builder --chown=appuser:0 /app/server/scripts ./app/server/scripts
COPY --from=builder --chown=appuser:0 /app/server/dist ./app/server/dist
2025-07-09 12:08:58 +00:00
COPY --from=builder --chown=appuser:0 /app/server/ee/ai/assets ./app/server/ee/ai/assets
2025-08-05 06:58:01 +00:00
COPY ./docker/LTS/ee/ee-entrypoint.sh ./app/server/ee-entrypoint.sh
2025-02-25 07:05:17 +00:00
2025-06-05 11:55:35 +00:00
RUN mkdir -p /var/lib/neo4j/data/databases /var/lib/neo4j/data/transactions /var/log/neo4j /opt/neo4j/run && \
chown -R appuser:0 /var/lib/neo4j /var/log/neo4j /etc/neo4j /opt/neo4j/run && \
chmod -R 770 /var/lib/neo4j /var/log/neo4j /etc/neo4j /opt/neo4j/run && \
chmod -R 644 /var/lib/neo4j/plugins/*.jar && \
chown -R appuser:0 /var/lib/neo4j/plugins && \
chmod 755 /var/lib/neo4j/plugins
# Create directory /home/appuser and set ownership to appuser
2025-02-25 07:05:17 +00:00
RUN mkdir -p /home/appuser \
&& chown -R appuser:0 /home/appuser \
&& chmod g+s /home/appuser \
&& chmod -R g=u /home/appuser \
&& npm cache clean --force
2025-06-05 11:55:35 +00:00
# Create directory /tmp/.npm/npm-cache/ and set ownership to appuser
2025-02-25 07:05:17 +00:00
RUN mkdir -p /tmp/.npm/npm-cache/ \
&& chown -R appuser:0 /tmp/.npm/npm-cache/ \
&& chmod g+s /tmp/.npm/npm-cache/ \
&& chmod -R g=u /tmp/.npm/npm-cache \
&& npm cache clean --force
# Set npm cache directory globally
RUN npm config set cache /tmp/.npm/npm-cache/ --global
ENV npm_config_cache /tmp/.npm/npm-cache/
# Create directory /tmp/.npm/npm-cache/_logs and set ownership to appuser
RUN mkdir -p /tmp/.npm/npm-cache/_logs \
&& chown -R appuser:0 /tmp/.npm/npm-cache/_logs \
&& chmod g+s /tmp/.npm/npm-cache/_logs \
&& chmod -R g=u /tmp/.npm/npm-cache/_logs
2025-03-18 05:41:49 +00:00
# Create Redis data, log, and configuration directories
RUN mkdir -p /var/lib/redis /var/log/redis /etc/redis \
&& chown -R appuser:0 /var/lib/redis /var/log/redis /etc/redis \
&& chmod g+s /var/lib/redis /var/log/redis /etc/redis \
&& chmod -R g=u /var/lib/redis /var/log/redis /etc/redis
2025-02-25 07:05:17 +00:00
ENV HOME=/home/appuser
# Switch back to appuser
USER appuser
WORKDIR /app
2025-06-30 14:08:44 +00:00
RUN npm install --prefix server --no-save dotenv@10.0.0 joi@17.4.1 && npm cache clean --force
2025-02-25 07:05:17 +00:00
2025-04-15 06:52:18 +00:00
ENTRYPOINT ["./server/ee-entrypoint.sh"]