-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathDockerfile
More file actions
118 lines (103 loc) · 5.9 KB
/
Copy pathDockerfile
File metadata and controls
118 lines (103 loc) · 5.9 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
FROM ubuntu:noble as initial
ARG TARGETPLATFORM
ARG DEV
ARG DAEMON_URL
ARG DEBIAN_FRONTEND=noninteractive
RUN groupadd -r manticore && useradd -r -g manticore manticore
ENV GOSU_VERSION 1.11
ENV DAEMON_URL ${DAEMON_URL:-"https://repo.manticoresearch.com/repository/manticoresearch_jammy/dists/jammy/main/binary-_ARCH_64/manticore_27.1.5-26061911-5a1cf9399__ARCH_64.deb"}
RUN if [ -z "$DAEMON_URL" ] ; then \
echo "WARNING: DAEMON_URL is empty"; \
elif [ ! -z "${DAEMON_URL##*_ARCH_*}" ] ; then \
echo "ERROR: DAEMON_URL is not empty, but no _ARCH_ placeholder found in daemon URL"; \
exit 1; \
fi
RUN set -x \
&& if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then export ARCH="arm"; else export ARCH="amd"; fi \
&& echo "Start building image for linux/${ARCH}64 architecture" \
&& mkdir /etc/ssl/ \
&& chown -R manticore:manticore /etc/ssl/ \
&& apt-get -y update && apt-get -y install --no-install-recommends ca-certificates \
binutils wget gnupg xz-utils dirmngr locales tzdata cron && rm -rf /var/lib/apt/lists/* \
&& locale-gen --lang en_US \
&& wget -q -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -q -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get update && apt-get -y install libexpat1 libodbc2 libpq5 openssl libcurl4 libcrypto++8 libmysqlclient21 mysql-client \
&& apt-get -y purge --auto-remove \
&& rm -f /usr/bin/mariabackup /usr/bin/mysqlslap /usr/bin/mysqladmin /usr/bin/mysqlimport \
/usr/bin/mysqlshow /usr/bin/mbstream /usr/bin/mysql_waitpid /usr/bin/innotop /usr/bin/mysqlaccess /usr/bin/mytop \
/usr/bin/mysqlreport /usr/bin/mysqldumpslow /usr/bin/mysql_find_rows /usr/bin/mysql_fix_extensions \
/usr/bin/mysql_embedded /usr/bin/mysqlcheck
# The below is to make sure the following is never taken from cache
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
# Add any .deb or .ddeb packages in the current dir to install them all later
#ADD *deb /packages/
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then export ARCH="arm"; else export ARCH="amd"; fi \
&& if [ "${DEV}" = "1" ]; then \
echo "2nd step of building dev image for linux/${ARCH}64 architecture" \
&& wget -q https://repo.manticoresearch.com/manticore-dev-repo.noarch.deb \
&& dpkg -i manticore-dev-repo.noarch.deb \
&& sed -i 's|http://repo.manticoresearch.com|https://repo.manticoresearch.com|g' /etc/apt/sources.list.d/*.list \
&& apt-key adv --fetch-keys 'https://repo.manticoresearch.com/GPG-KEY-manticore' && apt-get -y update \
&& apt-get -y install manticore-server manticore-tools manticore-dev manticore-icudata-65l manticore-buddy manticore-extra manticore-load manticore-language-packs;\
elif [ ! -z "$DAEMON_URL" ]; then \
echo "2nd step of building release image for linux/${ARCH}64 architecture" \
&& echo "ARCH: ${ARCH}" \
&& echo $DAEMON_URL | sed "s/_ARCH_/$ARCH/g" \
&& wget -q $(echo $DAEMON_URL | sed "s/_ARCH_/$ARCH/g") \
&& apt-get -y install ./manticore*deb \
&& rm *.deb ; \
fi
RUN set -eux \
&& if [ -d "/packages/" ]; then apt -y install /packages/*deb; fi \
&& mkdir -p /var/run/manticore \
&& mkdir /docker-entrypoint-initdb.d \
&& apt-get -y purge --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
&& rm -fr /packages \
&& rm -f /usr/bin/spelldump /usr/bin/wordbreaker \
&& mkdir -p /var/run/mysqld/ \
&& chown -R manticore:manticore /docker-entrypoint-initdb.d /var/lib/manticore/ /var/run/mysqld/ /var/run/manticore \
&& echo "\n[mysql]\nsilent\nwait\ntable\n" >> /etc/mysql/my.cnf
COPY manticore.conf.sh /etc/manticoresearch/
RUN sed -i '/log = \/var\/log\/manticore\/searchd.log/d;/query_log = \/var\/log\/manticore\/query.log/d' /etc/manticoresearch/manticore.conf
RUN md5sum /etc/manticoresearch/manticore.conf | awk '{print $1}' > /manticore.conf.md5
COPY component-licenses /licenses
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh
RUN touch /etc/cron.d/manticore /var/run/crond.pid && \
chown manticore:manticore /etc/cron.d/manticore /var/run/crond.pid && \
chmod gu+s /usr/sbin/cron
FROM scratch
COPY --from=initial / /
WORKDIR /var/lib/manticore
VOLUME /var/lib/manticore
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 9306
EXPOSE 9308
EXPOSE 9312
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV MANTICORE_CONFIG "/etc/manticoresearch/manticore.conf.sh|/etc/manticoresearch/manticore.conf"
CMD ["searchd", "-c", "/etc/manticoresearch/manticore.conf.sh", "--nodetach"]
# How to build manually:
# Prepare builder:
# docker buildx create --use
#
# Dev version:
# Build and load to local registry:
# docker buildx build --progress=plain --build-arg DEV=1 --load --platform linux/amd64 --tag manticore:dev .
# Build multi-arch and push to remote registry:
# docker buildx build --progress=plain --build-arg DEV=1 --push --platform linux/amd64,linux/arm64 --tag username/manticore:dev .
# Release version:
# docker buildx build --build-arg DEV=0 --progress plain --push --platform linux/arm64,linux/amd64 --tag manticoresearch/manticore:6.3.2 --tag manticoresearch/manticore:latest .
#
# With empty urls assuming *deb in the local dir:
# docker buildx build --progress=plain --build-arg DEV=0 --build-arg DAEMON_URL="" --build-arg --load --platform linux/amd64 --tag username/manticore:local .