35 lines
1.0 KiB
Docker
35 lines
1.0 KiB
Docker
# Use RHEL 9 UBI as the base
|
|
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
|
|
|
|
# Define Mattermost version and architecture
|
|
ARG MM_VERSION=11.4.0
|
|
ARG MM_PACKAGE=mattermost-${MM_VERSION}-linux-amd64.tar.gz
|
|
|
|
# Set environment variables
|
|
ENV PATH="/mattermost/bin:${PATH}"
|
|
ENV MM_INSTALL_TYPE=docker
|
|
|
|
# 1. Install necessary dependencies
|
|
# 2. Create mattermost user/group for security
|
|
# 3. Download and extract the binary
|
|
RUN microdnf update -y && \
|
|
microdnf install -y tar gzip shadow-utils ca-certificates findutils && \
|
|
groupadd -g 2000 mattermost && \
|
|
useradd -u 2000 -g mattermost -m -s /sbin/nologin mattermost && \
|
|
curl -L https://releases.mattermost.com/${MM_VERSION}/${MM_PACKAGE} | tar -xz && \
|
|
mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins && \
|
|
chown -R mattermost:mattermost /mattermost && \
|
|
microdnf clean all
|
|
|
|
# Set the working directory
|
|
WORKDIR /mattermost
|
|
|
|
# Mattermost uses these ports
|
|
EXPOSE 8065 8067
|
|
|
|
# Switch to non-root user
|
|
USER mattermost
|
|
|
|
# Start the Mattermost server
|
|
CMD ["mattermost"]
|