Merge ~mthaddon/charm-k8s-mattermost/+git/charm-k8s-mattermost:image-build into charm-k8s-mattermost:master

Proposed by Tom Haddon
Status: Merged
Approved by: Tom Haddon
Approved revision: 1869378295c194d05b4247166b87425a86a43d2d
Merged at revision: c20c99f0499ac06b1607f83c91e554cd791f8bd2
Proposed branch: ~mthaddon/charm-k8s-mattermost/+git/charm-k8s-mattermost:image-build
Merge into: charm-k8s-mattermost:master
Diff against target: 101 lines (+89/-0)
2 files modified
.jujuignore (+5/-0)
Dockerfile (+84/-0)
Reviewer Review Type Date Requested Status
Paul Collins Approve
Canonical IS Reviewers Pending
Review via email: mp+395895@code.launchpad.net

Commit message

Add Dockerfile to main charm project, now it can be ignored from charm builds via .jujuignore

Description of the change

Add Dockerfile to main charm project, now it can be ignored from charm builds via .jujuignore.

Things we'll need to update once this has landed:
 - https://charmhub.io/mattermost/docs/plugins-custom-images to point to the correct Dockerfile location
 - OCI Recipe build https://launchpad.net/~mattermost-charmers/charm-k8s-mattermost/+oci/mattermost/+recipe/mattermost to use the correct branch
 - Internal wiki documentation on how to build custom image for internal usage

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Paul Collins (pjdc) :
review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision c20c99f0499ac06b1607f83c91e554cd791f8bd2

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.jujuignore b/.jujuignore
2new file mode 100644
3index 0000000..86f0ca1
4--- /dev/null
5+++ b/.jujuignore
6@@ -0,0 +1,5 @@
7+/env
8+*.py[cod]
9+*.charm
10+Dockerfile
11+Makefile
12diff --git a/Dockerfile b/Dockerfile
13new file mode 100644
14index 0000000..0132752
15--- /dev/null
16+++ b/Dockerfile
17@@ -0,0 +1,84 @@
18+FROM ubuntu:focal
19+
20+# We use "set -o pipefail"
21+SHELL ["/bin/bash", "-c"]
22+
23+ARG edition=enterprise
24+ARG image_flavour=default
25+ARG mattermost_gid=2000
26+ARG mattermost_uid=2000
27+ARG mattermost_version=5.27.0
28+ARG mattermost_webapp=mattermost-webapp.tar.gz
29+
30+LABEL org.label-schema.version=${mattermost_version}
31+LABEL com.canonical.image-flavour=${image_flavour}
32+LABEL com.canonical.mattermost-edition=${edition}
33+
34+# python3-yaml needed to run juju actions.
35+RUN apt-get -qy update && \
36+ apt-get -qy dist-upgrade && \
37+ apt-get -qy install curl python3-yaml xmlsec1 && \
38+ rm -f /var/lib/apt/lists/*_*
39+
40+RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins && \
41+ set -o pipefail && \
42+ case $edition in \
43+ enterprise) \
44+ curl https://releases.mattermost.com/$mattermost_version/mattermost-$mattermost_version-linux-amd64.tar.gz | tar -xvz ; \
45+ ;; \
46+ team) \
47+ curl https://releases.mattermost.com/$mattermost_version/mattermost-team-$mattermost_version-linux-amd64.tar.gz | tar -xvz ; \
48+ ;; \
49+ *) \
50+ echo "E: Unknown edition ${edition}! Cannot continue." >&2 ; \
51+ exit 1 ; \
52+ ;; \
53+ esac && \
54+ addgroup --gid ${mattermost_gid} mattermost && \
55+ adduser --no-create-home --disabled-password --gecos "" --uid ${mattermost_uid} --gid ${mattermost_gid} --home /mattermost mattermost
56+
57+# Enable prepackaged plugin
58+RUN if [ "$image_flavour" = canonical ]; then \
59+ tar -C /mattermost/plugins -xvzf /mattermost/prepackaged_plugins/mattermost-plugin-autolink-v1.1.2-linux-amd64.tar.gz ; \
60+ fi
61+
62+# Enable prepackaged plugin
63+RUN if [ "$image_flavour" = canonical ]; then \
64+ tar -C /mattermost/plugins -xvzf /mattermost/prepackaged_plugins/mattermost-plugin-github-v0.14.0-linux-amd64.tar.gz ; \
65+ fi
66+
67+# Enable prepackaged plugin
68+RUN if [ "$image_flavour" = canonical ]; then \
69+ tar -C /mattermost/plugins -xvzf /mattermost/prepackaged_plugins/mattermost-plugin-gitlab-v1.1.0-linux-amd64.tar.gz ; \
70+ fi
71+
72+# Download and enable third-party plugin
73+RUN if [ "$image_flavour" = canonical ]; then \
74+ cd /mattermost/plugins && \
75+ set -o pipefail && \
76+ curl -L https://github.com/moussetc/mattermost-plugin-giphy/releases/download/v1.3.0/com.github.moussetc.mattermost.plugin.giphy-1.3.0.tar.gz | tar -xvz ; \
77+ fi
78+
79+# Download and enable third-party plugin
80+RUN if [ "$image_flavour" = canonical ]; then \
81+ cd /mattermost/plugins && \
82+ set -o pipefail && \
83+ curl -L https://github.com/scottleedavis/mattermost-plugin-remind/releases/download/0.4.4/com.github.scottleedavis.mattermost-plugin-remind-0.4.4.tar.gz | tar -xvz ; \
84+ fi
85+
86+# Canonical's custom webapp
87+RUN if [ "$image_flavour" = canonical ]; then \
88+ rm -rf /mattermost/client && \
89+ set -o pipefail && \
90+ curl http://archive.admin.canonical.com/other/mattermost-webapp/${mattermost_version}-canonical/${mattermost_webapp} | tar -C /mattermost -xvz ; \
91+ fi
92+
93+HEALTHCHECK CMD curl --fail http://localhost:8065 || exit 1
94+
95+CMD ["/mattermost/bin/mattermost"]
96+WORKDIR /mattermost
97+
98+# The default port
99+EXPOSE 8065
100+
101+VOLUME ["/mattermost/data", "/mattermost/logs", "/mattermost/config", "/mattermost/plugins", "/mattermost/client/plugins"]

Subscribers

People subscribed via source and target branches