Archived
Production Hardening (#241)
This commit is contained in:
1 parent
4f0a5376f3
commit
f79bbea7a4
8 files changed
+49
-14
No files matched your search
+17
-4
@@ -6,6 +6,9 @@ ENV MM_VERSION=4.9.0
|
||||
|
||||
# Build argument to set Mattermost edition
|
||||
ARG edition=enterprise
|
||||
ARG PUID=2000
|
||||
ARG PGID=2000
|
||||
|
||||
|
||||
# Install some needed packages
|
||||
RUN apk add --no-cache \
|
||||
@@ -27,14 +30,24 @@ RUN mkdir -p /mattermost/data \
|
||||
&& cp /mattermost/config/config.json /config.json.save \
|
||||
&& rm -rf /mattermost/config/config.json
|
||||
|
||||
# Get ready for production
|
||||
RUN addgroup -g ${PGID} mattermost \
|
||||
&& adduser -D -u ${PUID} -G mattermost -h /mattermost -D mattermost \
|
||||
&& chown -R mattermost:mattermost /mattermost /config.json.save
|
||||
|
||||
USER mattermost
|
||||
|
||||
#Healthcheck to make sure container is ready
|
||||
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1
|
||||
|
||||
# Configure entrypoint and command
|
||||
COPY entrypoint.sh /
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
WORKDIR /mattermost
|
||||
CMD ["platform"]
|
||||
|
||||
# Expose port 80 of the container
|
||||
EXPOSE 80
|
||||
# Expose port 8000 of the container
|
||||
EXPOSE 8000
|
||||
|
||||
# Use a volume for the data directory
|
||||
VOLUME /mattermost/data
|
||||
# Declare volumes for mount point directories
|
||||
VOLUME ["/mattermost/data", "/mattermost/logs", "/mattermost/config"]
|
||||
+1
-1
@@ -35,7 +35,7 @@ if [ "$1" = 'platform' ]; then
|
||||
# Copy default configuration file
|
||||
cp /config.json.save $MM_CONFIG
|
||||
# Substitue some parameters with jq
|
||||
jq '.ServiceSettings.ListenAddress = ":80"' $MM_CONFIG > $MM_CONFIG.tmp && mv $MM_CONFIG.tmp $MM_CONFIG
|
||||
jq '.ServiceSettings.ListenAddress = ":8000"' $MM_CONFIG > $MM_CONFIG.tmp && mv $MM_CONFIG.tmp $MM_CONFIG
|
||||
jq '.LogSettings.EnableConsole = false' $MM_CONFIG > $MM_CONFIG.tmp && mv $MM_CONFIG.tmp $MM_CONFIG
|
||||
jq '.LogSettings.ConsoleLevel = "INFO"' $MM_CONFIG > $MM_CONFIG.tmp && mv $MM_CONFIG.tmp $MM_CONFIG
|
||||
jq '.FileSettings.Directory = "/mattermost/data/"' $MM_CONFIG > $MM_CONFIG.tmp && mv $MM_CONFIG.tmp $MM_CONFIG
|
||||
|
||||
Reference in new issue
Block a user