fix: Remove version dependency from Dockerfile (#26812)

This commit is contained in:
Antonis Stamatiou 2024-04-17 15:19:59 +03:00 committed by GitHub
parent 1530228308
commit fae7aa79fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,14 +1,17 @@
FROM ubuntu:jammy-20230308@sha256:7a57c69fe1e9d5b97c5fe649849e79f2cfc3bf11d10bbd5218b4eb61716aebe6 FROM ubuntu:jammy-20230308@sha256:7a57c69fe1e9d5b97c5fe649849e79f2cfc3bf11d10bbd5218b4eb61716aebe6
# Setting bash as our shell, and enabling pipefail option # Setting bash as our shell, and enabling pipefail option
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Some ENV variables # Some ENV variables
ENV PATH="/mattermost/bin:${PATH}" ENV PATH="/mattermost/bin:${PATH}"
# Build Arguments
ARG PUID=2000 ARG PUID=2000
ARG PGID=2000 ARG PGID=2000
ARG MM_PACKAGE="https://releases.mattermost.com/9.7.1/mattermost-9.7.1-linux-amd64.tar.gz?src=docker" # MM_PACKAGE build arguments controls which version of mattermost to install, defaults to latest stable enterprise
# i.e. https://releases.mattermost.com/9.7.1/mattermost-9.7.1-linux-amd64.tar.gz
ARG MM_PACKAGE="https://latest.mattermost.com/mattermost-enterprise-linux"
# # Install needed packages and indirect dependencies # # Install needed packages and indirect dependencies
RUN apt-get update \ RUN apt-get update \
@ -27,18 +30,17 @@ RUN apt-get update \
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \ RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
&& addgroup -gid ${PGID} mattermost \ && addgroup -gid ${PGID} mattermost \
&& adduser -q --disabled-password --uid ${PUID} --gid ${PGID} --gecos "" --home /mattermost mattermost \ && adduser -q --disabled-password --uid ${PUID} --gid ${PGID} --gecos "" --home /mattermost mattermost \
&& if [ -n "$MM_PACKAGE" ]; then curl $MM_PACKAGE | tar -xvz ; \ && curl -L $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 && chown -R mattermost:mattermost /mattermost /mattermost/data /mattermost/plugins /mattermost/client/plugins
# We should refrain from running as privileged user # We should refrain from running as privileged user
USER mattermost USER mattermost
#Healthcheck to make sure container is ready # Healthcheck to make sure container is ready
HEALTHCHECK --interval=30s --timeout=10s \ HEALTHCHECK --interval=30s --timeout=10s \
CMD curl -f http://localhost:8065/api/v4/system/ping || exit 1 CMD curl -f http://localhost:8065/api/v4/system/ping || exit 1
# Configure entrypoint and command # Configure entrypoint and command with proper permissions
COPY --chown=mattermost:mattermost --chmod=765 entrypoint.sh / COPY --chown=mattermost:mattermost --chmod=765 entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /mattermost WORKDIR /mattermost