关于 Mattermost 服务端的安装搭建在此不做赘述,如果有朋友需要经验可以留言评论。我使用的是官方的 Dockerfile 构建并运行的。主程序 Dockerfile 位于 app/Dockerfile,mm 官方 GitHub 仓库地址: https://github.com/mattermost/mattermost-server

FROM alpine:3.10

# Some ENV variables
ENV PATH="/mattermost/bin:${PATH}"
ENV MM_INSTALL_TYPE=docker

# Build argument to set Mattermost edition
ARG edition=enterprise
ARG PUID=1002
ARG PGID=1003
ARG MM_BINARY=
#ARG MM_VERSION=5.37.9
ARG MM_VERSION=7.8.0

# Install some needed packages
RUN apk add --no-cache \
        ca-certificates \
        curl \
        jq \
        libc6-compat \
        libffi-dev \
        libcap \
        linux-headers \
        mailcap \
        netcat-openbsd \
        xmlsec-dev \
        tzdata \
        && rm -rf /tmp/*

# Get Mattermost
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
        && if [ ! -z "$MM_BINARY" ]; then curl $MM_BINARY | tar -xvz ; \
                elif [ "$edition" = "team" ] ; then curl https://releases.mattermost.com/$MM_VERSION/mattermost-team-$MM_VERSION-linux-amd64.tar.gz?src=docker-app | tar -xvz ; \
                else curl https://releases.mattermost.com/$MM_VERSION/mattermost-$MM_VERSION-linux-amd64.tar.gz?src=docker-app | tar -xvz ; fi \
        && cp /mattermost/config/config.json /config.json.save \
        && rm -rf /mattermost/config/config.json \
        && addgroup -g ${PGID} mattermost \
        && adduser -D -u ${PUID} -G mattermost -h /mattermost -D mattermost \
        && chown -R mattermost:mattermost /mattermost /config.json.save /mattermost/plugins /mattermost/client/plugins \
        && setcap cap_net_bind_service=+ep /mattermost/bin/mattermost

USER mattermost

#Healthcheck to make sure container is ready
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1

# Configure entrypoint and command
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /mattermost
CMD ["mattermost"]

# Expose port 8000 of the container
EXPOSE 8000

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

修改 MM_VERSION 为 7.8.0 之后发现卡在了 # Get Mattermost 的步骤,原因是与官方的服务器网络不通畅,下载速度特别慢,还容易丢失连接。

curl https://releases.mattermost.com/$MM_VERSION/mattermost-$MM_VERSION-linux-amd64.tar.gz?src=docker-app | tar -xvz

将此压缩包下载到本地, https://releases.mattermost.com/7.8.0/mattermost-7.8.0-linux-amd64.tar.gz?src=docker-app

然后上传到我的 Seafile,生成分享链接后通过 curl 获取文件直链,参考文章 获取 Seafile 分享的文件直链 ,再更改 Dockerfile,就可以很快的 docker-compose build 了。

当时用 curl/wget -O mattermost-7.8.0-linux-amd64.tar.gz 都没有成功,拿到文件直链轻松解决。 https://emby.940304.xyz:23399/seafhttp/files/ac915dbb-14b7-4815-80c9-2d989f1830a2/mattermost-7.8.0-linux-amd64.tar.gz.tar

更新 mattermost 版本

mattermost 7.8.0