# FROM postgres:12 # # 设置用户 ID 和组 ID #ARG UID=1000 #ARG GID=1000 # 创建用户和组 #RUN groupadd -g ${GID} postgresgroup && \ # useradd -u ${UID} -g ${GID} -m -s /bin/bash postgresuser # 更改数据目录的所有权 #RUN chown -R ${UID}:${GID} /var/lib/postgresql/data # 切换到新创建的用户 #USER postgresuser # 设置环境变量 (可选,根据需要修改) #ENV POSTGRES_USER=mmuser #ENV POSTGRES_PASSWORD=mostest #ENV POSTGRES_DB=mattermost_test # 暴露端口 #EXPOSE 5432 # Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. # See License.txt for license information. FROM postgres:12 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 RUN apt-get update && apt-get install -y ca-certificates # 设置用户 ID 和组 ID ARG UID=1000 ARG GID=1000 # 创建用户和组 RUN groupadd -g ${GID} mmgroup && \ useradd -u ${UID} -g ${GID} -m -s /bin/bash mmuser # 更改数据目录的所有权 RUN chown -R ${UID}:${GID} /var/lib/postgresql/data # # Configure SQL # ENV POSTGRES_USER=mmuser ENV POSTGRES_PASSWORD=mostest ENV POSTGRES_DB=mattermost_test # # Configure Mattermost # WORKDIR /mm # Copy over files ADD https://releases.mattermost.com/9.7.1/mattermost-team-9.7.1-linux-amd64.tar.gz . RUN tar -zxvf mattermost-team-*-linux-amd64.tar.gz ADD config_docker.json ./mattermost/config/config_docker.json ADD docker-entry.sh . RUN chmod +x ./docker-entry.sh ENTRYPOINT ./docker-entry.sh # Mattermost environment variables ENV PATH="/mm/mattermost/bin:${PATH}" # Create default storage directory RUN mkdir ./mattermost-data VOLUME /mm/mattermost-data # 切换到新创建的用户 USER mmuser # Ports EXPOSE 8065