updated dockerfile and deployment
This commit is contained in:
27
Dockerfile
27
Dockerfile
@@ -6,23 +6,33 @@ ARG MM_VERSION=11.4.0
|
||||
ARG MM_PACKAGE=mattermost-${MM_VERSION}-linux-amd64.tar.gz
|
||||
|
||||
# Set environment variables
|
||||
ENV PATH="/mattermost/bin:${PATH}"
|
||||
# We include the bin in the PATH and explicitly set the working dir
|
||||
ENV PATH="/opt/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
|
||||
# 2. Create mattermost user/group
|
||||
# 3. Create the target directory FIRST
|
||||
# 4. Download, extract, and move
|
||||
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 && \
|
||||
# Create the directory before moving things into it
|
||||
mkdir -p /opt/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 && \
|
||||
# Move extracted contents into /opt/mattermost
|
||||
mv mattermost/* /opt/mattermost/ && \
|
||||
rm -rf mattermost && \
|
||||
# Create required subdirectories
|
||||
mkdir -p /opt/mattermost/config /opt/mattermost/data /opt/mattermost/logs \
|
||||
/opt/mattermost/plugins /opt/mattermost/client/plugins /opt/mattermost/bleve-indexes && \
|
||||
# Fix permissions
|
||||
chown -R mattermost:mattermost /opt/mattermost && \
|
||||
microdnf clean all
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /mattermost
|
||||
# Set the working directory - Mattermost looks for config/ relative to this path
|
||||
WORKDIR /opt/mattermost
|
||||
|
||||
# Mattermost uses these ports
|
||||
EXPOSE 8065 8067
|
||||
@@ -31,4 +41,5 @@ EXPOSE 8065 8067
|
||||
USER mattermost
|
||||
|
||||
# Start the Mattermost server
|
||||
CMD ["mattermost"]
|
||||
# Explicitly point to the config file to avoid the "Permission Denied" on /mattermost
|
||||
CMD ["mattermost", "--config", "/opt/mattermost/config/config.json"]
|
||||
|
||||
Reference in New Issue
Block a user