Skip to content
Snippets Groups Projects
Dockerfile 1.45 KiB
Newer Older
Quentin Duchemin's avatar
Quentin Duchemin committed
FROM alpine:3.11

# Some ENV variables
ENV PATH="/mattermost/bin:${PATH}"

Quentin Duchemin's avatar
Quentin Duchemin committed
# Picasoft : change these values. The team version is used by default
# Get these ids with the output of `id mattermost` on the VM hosting the app
ARG PUID=5000
ARG PGID=5000

# Install some needed packages
RUN apk add --no-cache \
	ca-certificates \
	curl \
	libc6-compat \
	libffi-dev \
  libcap \
	linux-headers \
	mailcap \
	netcat-openbsd \
	xmlsec-dev \
	tzdata \
	&& rm -rf /tmp/*

# Get Mattermost
Quentin Duchemin's avatar
Quentin Duchemin committed
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 -xz \
    && 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

#Healthcheck to make sure container is ready
HEALTHCHECK --interval=20s --timeout=3s CMD curl --fail http://localhost:8000//api/v4/system/ping || exit 1

# Configure entrypoint and command
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
USER mattermost

WORKDIR /mattermost
CMD ["mattermost"]

# Expose port 8000 of the container
EXPOSE 8000