diff --git a/Dockerfile b/Dockerfile index c0731be..6083d94 100644 --- a/Dockerfile +++ b/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"] diff --git a/mattermost-deployment.yaml b/mattermost-deployment.yaml index f37be12..3531c98 100644 --- a/mattermost-deployment.yaml +++ b/mattermost-deployment.yaml @@ -28,7 +28,7 @@ spec: value: postgres - name: MM_SQLSETTINGS_DATASOURCE value: postgres://mattermost:mattermost@postgres:5432/mattermost?sslmode=disable&connect_timeout=10 - image: gitea.lab.cudanet.org/cudanet/mattermost/mattermost:v11.4.0 + image: gitea.lab.cudanet.org/cudanet/mattermost/mattermost:v11.4.0_2 imagePullPolicy: IfNotPresent name: mattermost ports: diff --git a/oc.tar b/oc.tar new file mode 100644 index 0000000..44ea660 Binary files /dev/null and b/oc.tar differ