RocketChat / Docker.Official.Image

Docker hub - community managed image
291 stars 217 forks source link

Proposition Dockerfile arm64 #190

Open manalejandro opened 1 year ago

manalejandro commented 1 year ago

Hello, i don't know if this project will be used much, i don't know much about the Rocket.Chat structure but i had to adapt the Dockerfile of version 6.0 to work on the Pi4, i based on your Dockerfile and aligned to the left the lines i have changed. Greetings

ARG NODE_IMAGE=${NODE_IMAGE:-node:14-bullseye-slim}
FROM ${NODE_IMAGE} as builder

ARG TOOLCHAIN=${TOOLCHAIN:-nightly-2023-04-23}
ARG RC_VERSION=${RC_VERSION:-6.1.5}
ENV TOOLCHAIN=${TOOLCHAIN}
ENV RC_VERSION=${RC_VERSION}

WORKDIR /app

RUN set -eux \
  && apt-get update \
  && apt-get install -y --no-install-recommends fontconfig \
  && aptMark="$(apt-mark showmanual)" \
&& apt-get install -y --no-install-recommends build-essential python3 ca-certificates curl gnupg cmake wget \
  && rm -rf /var/lib/apt/lists/* \
  # gpg: key 4FD08104: public key "Rocket.Chat Buildmaster <buildmaster@rocket.chat>" imported
  && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0E163286C20D07B9787EBE9FD7F9D0414FD08104 \
&& curl -fSL "https://releases.rocket.chat/$RC_VERSION/download" -o rocket.chat.tgz \
&& curl -fSL "https://releases.rocket.chat/$RC_VERSION/asc" -o rocket.chat.tgz.asc \
  && gpg --batch --verify rocket.chat.tgz.asc rocket.chat.tgz \
  && tar zxf rocket.chat.tgz \
  && rm rocket.chat.tgz rocket.chat.tgz.asc \
&& wget -O /app/bundle/programs/server/npm/node_modules/@rocket.chat/forked-matrix-sdk-crypto-nodejs/lib/index.linux-arm64-gnu.node \
https://github.com/matrix-org/matrix-rust-sdk/releases/download/matrix-sdk-crypto-nodejs-v0.1.0-beta.6/matrix-sdk-crypto.linux-arm64-gnu.node \
&& curl -fSL https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.1.0/bcrypt_lib-v5.1.0-napi-v3-linux-arm64-glibc.tar.gz | gzip -d > \
/app/bundle/programs/server/npm/node_modules/meteor/accounts-password/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& . "$HOME/.cargo/env" \
&& rustup default $TOOLCHAIN \
  && cd bundle/programs/server \
&& yarn \
  && apt-mark auto '.*' > /dev/null \
  && apt-mark manual $aptMark > /dev/null \
  && 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 \
  && npm cache clear --force
#  && chown -R rocketchat:rocketchat /app

FROM ${NODE_IMAGE}

RUN set -eux \
  && apt-get update \
  && apt-get install -y --no-install-recommends fontconfig \
  && apt clean

RUN groupadd -r rocketchat \
  && useradd -r -g rocketchat rocketchat \
  && mkdir -p /app/uploads \
  && chown rocketchat:rocketchat /app/uploads

COPY --chown=rocketchat:rocketchat --from=builder /app /app

USER rocketchat

WORKDIR /app/bundle

# needs a mongoinstance - defaults to container linking with alias 'db'
ENV DEPLOY_METHOD=docker-official \
  MONGO_URL=mongodb://db:27017/meteor \
  HOME=/tmp \
  PORT=3000 \
  ROOT_URL=http://localhost:3000 \
  Accounts_AvatarStorePath=/app/uploads

EXPOSE 3000

CMD ["node", "main.js"]