2023-02-13 11:05:56 +01:00
|
|
|
FROM alpine:3.17
|
2021-12-12 15:03:43 +01:00
|
|
|
|
|
|
|
# Some ENV variables
|
|
|
|
ENV PATH="/mattermost/bin:${PATH}"
|
|
|
|
|
|
|
|
# Build argument to set Mattermost edition
|
2023-02-13 11:05:56 +01:00
|
|
|
ARG MM_VERSION
|
2021-12-12 15:03:43 +01:00
|
|
|
ARG PUID=2000
|
|
|
|
ARG PGID=2000
|
|
|
|
|
|
|
|
|
|
|
|
# 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 \
|
|
|
|
postgresql-client \
|
|
|
|
&& rm -rf /tmp/*
|
|
|
|
|
|
|
|
# Get Mattermost
|
|
|
|
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
|
|
|
|
&& curl https://releases.mattermost.com/$MM_VERSION/mattermost-team-$MM_VERSION-linux-amd64.tar.gz | tar -xvz \
|
|
|
|
&& 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
|
|
|
|
|
|
|
|
# Expose port 8000 of the container
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
#Healthcheck to make sure container is ready
|
|
|
|
HEALTHCHECK CMD curl --fail http://localhost:8000/api/v4/system/ping || exit 1
|
|
|
|
|
|
|
|
USER mattermost
|
|
|
|
|
|
|
|
# Configure entrypoint and command
|
|
|
|
COPY entrypoint.sh /
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
WORKDIR /mattermost
|
|
|
|
CMD ["mattermost"]
|