-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
97 lines (74 loc) · 3.64 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
FROM almalinux:8.6-20220901
ARG SECURITY_UPDATES_AS_OF=2022-09-30
RUN rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
RUN dnf upgrade -y almalinux-release && \
yum -y clean all
RUN yum makecache --refresh && \
yum install -y yum-utils wget procps java-11-openjdk && \
yum update -y curl && \
yum-config-manager --save --setopt=skip_missing_names_on_install=0 && \
yum -y update-minimal --setopt=tsflags=nodocs --nobest --security --sec-severity=Important --sec-severity=Critical && \
dnf --enablerepo=* clean all && \
dnf update -y && \
yum remove -y vim-minimal platform-python-pip.noarch && \
yum update -y expat libxml2 libgcrypt && \
yum clean all
RUN cd /tmp && \
wget https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz && \
tar xzvf openjdk-21+35_linux-x64_bin.tar.gz && \
mv jdk-21 /usr/local/ && \
rm -f openjdk-21+35_linux-x64_bin.tar.gz && \
cd ..
ENV JQ_VERSION='1.6'
RUN wget --no-check-certificate https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-old.key -O /tmp/jq-release.key && \
wget --no-check-certificate https://raw.githubusercontent.com/jqlang/jq/master/sig/v${JQ_VERSION}/jq-linux64.asc -O /tmp/jq-linux64.asc && \
wget --no-check-certificate https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64 && \
gpg --import /tmp/jq-release.key && \
gpg --verify /tmp/jq-linux64.asc /tmp/jq-linux64 && \
cp /tmp/jq-linux64 /usr/bin/jq && \
chmod +x /usr/bin/jq && \
rm -f /tmp/jq-release.key && \
rm -f /tmp/jq-linux64.asc && \
rm -f /tmp/jq-linux64
ARG BOOTSTRAP_LICENSE
ARG CONFIG
RUN yum-config-manager --add-repo https://release.memsql.com/$(echo "${CONFIG}" | jq -r .channel)/rpm/x86_64/repodata/memsql.repo && \
yum install -y \
singlestore-client-$(echo "${CONFIG}" | jq -r .client) \
singlestoredb-toolbox-$(echo "${CONFIG}" | jq -r .toolbox) \
singlestoredb-studio-$(echo "${CONFIG}" | jq -r .studio) && \
yum clean all
ADD scripts/setup-singlestore-user.sh /scripts/setup-singlestore-user.sh
RUN /scripts/setup-singlestore-user.sh
RUN mkdir -p /server && chown -R singlestore:singlestore /server
RUN mkdir -p /data && chown -R singlestore:singlestore /data
RUN mkdir -p /logs && chown -R singlestore:singlestore /logs
# remove /var/lib/memsql, this image uses /data and /logs to store everything
# we also need to be able to detect when we are upgrading from the old cluster in a box image
RUN rm -rf /var/lib/memsql
ADD assets/memsqlctl.hcl /etc/memsql/memsqlctl.hcl
RUN chown singlestore:singlestore /etc/memsql/memsqlctl.hcl
RUN touch /data/nodes.hcl && chown singlestore:singlestore /data/nodes.hcl
ADD assets/studio.hcl /var/lib/singlestoredb-studio/studio.hcl
RUN chown -R singlestore:singlestore /var/lib/singlestoredb-studio
USER singlestore
RUN sdb-toolbox-config -y register-host \
--localhost \
--cluster-hostname 127.0.0.1 \
--skip-auto-config \
--memsqlctl-config-path /etc/memsql/memsqlctl.hcl \
--tar-install-dir /server
ADD scripts/install.sh /scripts/install.sh
RUN /scripts/install.sh "$(echo "${CONFIG}" | jq -r .channel):$(echo "${CONFIG}" | jq -r .server)"
ADD scripts/memsqlctl /bin/memsqlctl
ADD scripts/init.sh /scripts/init.sh
RUN /scripts/init.sh "${BOOTSTRAP_LICENSE}"
ADD scripts/switch-version.sh /scripts/switch-version.sh
ADD scripts/start.sh /scripts/start.sh
CMD ["/scripts/start.sh"]
ADD licenses /licenses
ADD scripts/healthcheck.sh /scripts/healthcheck.sh
HEALTHCHECK --interval=5s --timeout=5s --start-period=90s --retries=3 CMD /scripts/healthcheck.sh
EXPOSE 3306/tcp
EXPOSE 8080/tcp
EXPOSE 9000/tcp