ARG DENO_VERSION="1.37.1" FROM denoland/deno:bin-${DENO_VERSION} as deno FROM node:24.15.0-bullseye-slim LABEL maintainer="buildmaster@rocket.chat" # dependencies RUN groupadd -g 65533 -r rocketchat \ && useradd -u 65533 -r -g rocketchat rocketchat \ && mkdir -p /app/uploads \ && chown rocketchat:rocketchat /app/uploads \ && apt-get update \ && apt-get install -y --no-install-recommends fontconfig COPY --from=deno /deno /bin/deno # --chown requires Docker 17.12 and works only on Linux ADD --chown=rocketchat:rocketchat . /app # needs a mongoinstance - defaults to container linking with alias 'mongo' ENV DEPLOY_METHOD=docker \ NODE_ENV=production \ MONGO_URL=mongodb://mongo:27017/rocketchat \ HOME=/tmp \ PORT=3000 \ ROOT_URL=http://localhost:3000 \ Accounts_AvatarStorePath=/app/uploads RUN aptMark="$(apt-mark showmanual)" \ && apt-get install -y --no-install-recommends g++ make python3 ca-certificates \ && apt-mark auto '.*' > /dev/null \ && apt-mark manual $aptMark > /dev/null USER rocketchat RUN cd /app/bundle/programs/server \ && npm install --omit=dev \ && cd npm/node_modules/isolated-vm \ && npm install --omit=dev \ && npm cache clear --force \ # Drop sourcemaps from third-party prod deps and the client bundle: # - server/npm/node_modules: .map files shipped inside packages # (openpgp, date-fns, etc.). Node does not read them at runtime. # - web.browser: client-side bundle, maps have no runtime value in the image. # Maps under /app/bundle/programs/server/{app,packages,node_modules/meteor} # are loaded by Meteor's source-map-support at boot, so they are kept. && find /app/bundle/programs/server/npm/node_modules -type f -name '*.map' -delete \ && find /app/bundle/programs/web.browser -type f -name '*.map' -delete USER root RUN find /usr/local -type f -executable -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false USER rocketchat VOLUME /app/uploads WORKDIR /app/bundle EXPOSE 3000 CMD ["node", "main.js"]