[CLD-3942] Container Image used for e2e testing, migration from Alpine to Debian Linux (#20807)

* [fix] Dockerfile using Debian instead of Alpine

We are switching to building docker container for Matermmost-server & enterprise
from Alpine Linux(unsupported) to Debian(supported)

This image is used for e2e testing.

Rationalle:
Alpine is actually unsupported distro for Mattermost-server. https://docs.mattermost.com/install/software-hardware-requirements.html#mattermost-server-operating-system
On top of that, Alpine linux uses musl libc vs glibc, which can cause several issues when testing
Finally We got to a point of being unable to run Alpine based mattermost instances with: `Error relocating ./mattermost: fcntl64: symbol not found`
Details @ https://github.com/mattermost/mattermost-server/pull/20735

Specifically the following changes are introduced:

- switching to using Debian Buster as being a supported linux flavor for Mattermost
- pinning the Debian base image with SHA hash
- defining Shell as bash, and enabling pipefail
- pinning additional packages installed using apt
- removing unused cache
- improving MM_PACKAGE variable checking logic introducing non zero exit code (127) when failing
- migrating adduser and addgroup command, to debian compatible
- removing unused chown dirs

Signed-off-by: Akis Maziotis <akis.maziotis@mattermost.com>

* [fix] Using bash as a more capable shell

* [fix] Installing optional packages needed for tests

These packages are needed to perform succesfull end to end testing.
Relevant documentation:
https://docs.mattermost.com/configure/file-storage-configuration-settings.html#enable-document-search-by-content

Signed-off-by: Akis Maziotis <akis.maziotis@mattermost.com>
Этот коммит содержится в:
Akis Maziotis
2022-08-13 01:44:32 +03:00
коммит произвёл GitHub
родитель 6aa57e6242
Коммит efed80a90c
2 изменённых файлов: 24 добавлений и 25 удалений

Просмотреть файл

@@ -1,4 +1,7 @@
FROM alpine:3.14.6@sha256:06b5d462c92fc39303e6363c65e074559f8d6b1363250027ed5053557e3398c5
FROM debian:buster-slim@sha256:5b0b1a9a54651bbe9d4d3ee96bbda2b2a1da3d2fa198ddebbced46dfdca7f216
# Setting bash as our shell, and enabling pipefail option
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Some ENV variables
ENV PATH="/mattermost/bin:${PATH}"
@@ -6,38 +9,33 @@ ARG PUID=2000
ARG PGID=2000
ARG MM_PACKAGE="https://releases.mattermost.com/7.1.2/mattermost-7.1.2-linux-amd64.tar.gz?src=docker"
# # Install needed packages
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates=20200601~deb10u2 \
curl=7.64.0-4+deb10u2 \
mime-support=3.62 \
unrtf=0.21.10-clean-1 \
wv=1.2.9-4.2+b2 \
poppler-utils=0.71.0-5 \
tidy=2:5.6.0-10 \
&& rm -rf /var/lib/apt/lists/*
# Install some needed packages
RUN apk add --no-cache \
ca-certificates \
curl \
libc6-compat \
libffi-dev \
linux-headers \
mailcap \
netcat-openbsd \
xmlsec-dev \
tzdata \
wv \
poppler-utils \
tidyhtml \
&& rm -rf /tmp/*
# Get Mattermost
# Set mattermost group/user and download Mattermost
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
&& if [ ! -z "$MM_PACKAGE" ]; then curl $MM_PACKAGE | tar -xvz ; \
else echo "please set the MM_PACKAGE" ; fi \
&& addgroup -g ${PGID} mattermost \
&& adduser -D -u ${PUID} -G mattermost -h /mattermost -D mattermost \
&& chown -R mattermost:mattermost /mattermost /mattermost/plugins /mattermost/client/plugins
&& addgroup -gid ${PGID} mattermost \
&& adduser -q --disabled-password --uid ${PUID} --gid ${PGID} --gecos "" --home /mattermost mattermost \
&& if [ -n "$MM_PACKAGE" ]; then curl $MM_PACKAGE | tar -xvz ; \
else echo "please set the MM_PACKAGE" ; exit 127 ; fi \
&& chown -R mattermost:mattermost /mattermost /mattermost/data /mattermost/plugins /mattermost/client/plugins
# We should refrain from running as privileged user
USER mattermost
#Healthcheck to make sure container is ready
HEALTHCHECK --interval=30s --timeout=10s \
CMD curl -f http://localhost:8065/api/v4/system/ping || exit 1
# Configure entrypoint and command
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
@@ -48,3 +46,4 @@ EXPOSE 8065 8067 8074 8075
# Declare volumes for mount point directories
VOLUME ["/mattermost/data", "/mattermost/logs", "/mattermost/config", "/mattermost/plugins", "/mattermost/client/plugins"]

Просмотреть файл

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
if [ "${1:0:1}" = '-' ]; then
set -- mattermost "$@"