arm mattermost

It's not so hard, here is my working steps for arm64 device.

cd ~/build/mattermost
wget https://raw.githubusercontent.com/mattermost/mattermost/master/server/build/entrypoint.sh
 

Create a Dockerfile and edit version 9.2.1 to match your need.

FROM ubuntu:jammy

# Setting bash as our shell, and enabling pipefail option
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Some ENV variables
ENV PATH="/mattermost/bin:${PATH}"
ARG PUID=2000
ARG PGID=2000
ARG MM_PACKAGE="https://releases.mattermost.com/9.2.1/mattermost-9.2.1-linux-arm64.tar.gz?src=docker"

# # Install needed packages and indirect dependencies
RUN apt-get update \
  && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
  ca-certificates \
  curl \
  mime-support \
  unrtf \
  wv \
  poppler-utils \
  tidy \
  tzdata \
  && rm -rf /var/lib/apt/lists/*

# Set mattermost group/user and download Mattermost
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
  && addgroup -gid ${PGID} mattermost \
  && adduser -q --disabled-password --uid ${PUID} --gid ${PGID} --gecos "" --home /mattermost mattermost \
  && if [ -n "$MM_PACKAGE" ]; then curl $MM_PACKAGE | tar -xvz ; \
  else echo "please set the MM_PACKAGE" ; exit 127 ; fi \
  && chown -R mattermost:mattermost /mattermost /mattermost/data /mattermost/plugins /mattermost/client/plugins

# We should refrain from running as privileged user
USER mattermost

#Healthcheck to make sure container is ready
HEALTHCHECK --interval=30s --timeout=10s \
  CMD curl -f http://localhost:8065/api/v4/system/ping || exit 1

# Configure entrypoint and command
COPY --chown=mattermost:mattermost --chmod=765 entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /mattermost
CMD ["mattermost"]

EXPOSE 8065 8067 8074 8075

# Declare volumes for mount point directories
VOLUME ["/mattermost/data", "/mattermost/logs", "/mattermost/config", "/mattermost/plugins", "/mattermost/client/plugins"]
 

Build arm64 docker image

docker build . -t mattermost-arm:9.2.1
 

Mattermost working directory setup

cd /opt/mattermost
mkdir -p mattermost/{config,data,logs,plugins,bleve-indexes}
mkdir -p mattermost/client/plugins
chown 2000:2000 -R .
 

Create a compose.yaml file, edit chat.example.com to your domain name

services:
  postgres:
    container_name: postgres_mattermost
    image: postgres:16-alpine
    restart: unless-stopped
    volumes:
      - ./postgresql/data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=mattermost
      - POSTGRES_PASSWORD=mattermost
      - POSTGRES_DB=mattermost

  mattermost:
    depends_on:
      - postgres
    container_name: mattermost
    image: mattermost-arm:9.2.1
    restart: unless-stopped
    ports:
      - 127.0.0.1:8065:8065
    volumes:
      - ./mattermost/config:/mattermost/config
      - ./mattermost/data:/mattermost/data
      - ./mattermost/logs:/mattermost/logs
      - ./mattermost/plugins:/mattermost/plugins
      - ./mattermost/client/plugins:/mattermost/client/plugins
      - ./mattermost/bleve-indexes:/mattermost/bleve-indexes
    environment:
      # necessary Mattermost options/variables (see env.example)
      - MM_SQLSETTINGS_DRIVERNAME=postgres
      - MM_SQLSETTINGS_DATASOURCE=postgres://mattermost:mattermost@postgres:5432/mattermost?sslmode=disable&connect_timeout=10

      # necessary for bleve
      - MM_BLEVESETTINGS_INDEXDIR=/mattermost/bleve-indexes

      # additional settings
      - MM_SERVICESETTINGS_SITEURL=https://chat.example.com
 

Spin up container

docker compose up
 

If it looks okay, Ctrl+C then run the container in detach mode.

docker compose up -d
 

Edit: https://github.com/hibobmaster/useful-notes/tree/main/mattermost
You can use hibobmaster/mattermost-arm if you don't want to build it yourself.
Cheers!

 

 

 

https://docs.docker.com/build/concepts/overview/#install-buildx

 

https://github.com/docker/buildx?tab=readme-ov-file#manual-download

 

 

在构建Mattermost的ARM镜像时遇到“E: Package 'mime-support' has no installation candidate”的错误,通常是因为所使用的基础镜像或者APT源不支持ARM架构,或者该软件包在ARM架构的仓库中不可用。以下是一些可能的解决方案:

  1. 更换基础镜像:

    • 确保你使用的基础镜像支持ARM架构。你可以尝试使用不同的基础镜像,例如arm32v7/ubuntuarm64v8/ubuntu,这些镜像专为ARM架构设计。
  2. 检查APT源:

    • 确保你的Dockerfile中的APT源是最新的,并且支持ARM架构。你可以尝试更换为支持ARM的镜像源。
  3. 手动下载软件包:

    • 如果mime-support包在ARM架构的仓库中不可用,你可以尝试手动下载该软件包的ARM版本,并在Docker构建过程中安装。
  4. 使用多架构支持的基础镜像:

    • 考虑使用多架构支持的基础镜像,这样可以确保在不同架构上都能正确构建和运行。
  5. 使用替代软件包:

    • 如果mime-support不是必需的,可以考虑使用替代的软件包或者不安装该软件包。
  6. 构建ARM64镜像:

    • 根据搜索结果中的一个用户分享的步骤,你可以按照以下步骤构建ARM64的Mattermost镜像:
      dockerfile
      FROM ubuntu:jammy
      SHELL ["/bin/bash", "-o", "pipefail", "-c"]
      ENV PATH="/mattermost/bin:${PATH}"
      ARG PUID=2000
      ARG PGID=2000
      ARG MM_PACKAGE="https://releases.mattermost.com/9.2.1/mattermost-9.2.1-linux-arm64.tar.gz?src=docker"
      RUN apt-get update \
        && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
        ca-certificates \
        curl \
        unrtf \
        wv \
        poppler-utils \
        tidy \
        tzdata \
        && rm -rf /var/lib/apt/lists/*
      # 其他Dockerfile指令...
    • 注意,这里去除了mime-support包,因为它可能在ARM架构的仓库中不可用。
  7. 使用现有的ARM镜像:

    • 根据搜索结果,有用户分享了一个现有的ARM镜像hibobmaster/mattermost-arm,如果你不想自己构建,可以直接使用这个镜像

请根据你的具体需求和环境选择合适的解决方案。如果问题仍然存在,可能需要进一步检查你的Docker构建环境和网络配置。

posted @ 2024-12-23 23:55  牧之丨  阅读(76)  评论(0)    收藏  举报