2019-02-21 09:21:20 +00:00
|
|
|
# Since right now we can't set volumes to the docker during build, we split building container in stages:
|
|
|
|
# 1. build base container
|
|
|
|
# 2. run base conatiner with mounted volumes
|
|
|
|
# 3. commit container as image
|
|
|
|
# 4. build final container atop that image
|
|
|
|
# Middle steps are performed by the bash script.
|
|
|
|
|
|
|
|
FROM ubuntu:18.04 as clickhouse-server-base
|
2019-02-11 07:57:51 +00:00
|
|
|
ARG gosu_ver=1.10
|
|
|
|
|
2019-02-21 09:21:20 +00:00
|
|
|
VOLUME /packages/
|
2019-02-11 07:57:51 +00:00
|
|
|
|
2019-02-21 09:21:20 +00:00
|
|
|
# update to allow installing dependencies of clickhouse automatically
|
2019-02-11 07:57:51 +00:00
|
|
|
RUN apt update; \
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
2019-02-21 09:21:20 +00:00
|
|
|
apt install -y locales;
|
2019-02-11 07:57:51 +00:00
|
|
|
|
|
|
|
ADD https://github.com/tianon/gosu/releases/download/${gosu_ver}/gosu-amd64 /bin/gosu
|
|
|
|
|
|
|
|
RUN locale-gen en_US.UTF-8
|
|
|
|
ENV LANG en_US.UTF-8
|
|
|
|
ENV LANGUAGE en_US:en
|
|
|
|
ENV LC_ALL en_US.UTF-8
|
|
|
|
|
2019-02-21 09:21:20 +00:00
|
|
|
# installing via apt to simulate real-world scenario, where user installs deb package and all it's dependecies automatically.
|
|
|
|
CMD DEBIAN_FRONTEND=noninteractive \
|
|
|
|
apt install -y \
|
|
|
|
/packages/clickhouse-common-static_*.deb \
|
|
|
|
/packages/clickhouse-server_*.deb ;
|
|
|
|
|
|
|
|
FROM clickhouse-server-base:postinstall as clickhouse-server
|
|
|
|
|
2019-02-11 07:57:51 +00:00
|
|
|
RUN mkdir /docker-entrypoint-initdb.d
|
|
|
|
|
2019-02-21 09:21:20 +00:00
|
|
|
COPY docker_related_config.xml /etc/clickhouse-server/config.d/
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
2019-02-11 07:57:51 +00:00
|
|
|
|
|
|
|
RUN chmod +x \
|
|
|
|
/entrypoint.sh \
|
|
|
|
/bin/gosu
|
|
|
|
|
|
|
|
EXPOSE 9000 8123 9009
|
|
|
|
VOLUME /var/lib/clickhouse
|
|
|
|
|
|
|
|
ENV CLICKHOUSE_CONFIG /etc/clickhouse-server/config.xml
|
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|