File size: 1,356 Bytes
dcaba0f
49766cf
dcaba0f
49766cf
dcaba0f
8dd2750
 
dcaba0f
 
49766cf
dcaba0f
 
 
 
 
 
 
ead58be
dcaba0f
 
 
 
49766cf
1b5f18a
dcaba0f
 
 
 
49766cf
dcaba0f
 
 
 
 
49766cf
dcaba0f
49766cf
 
dcaba0f
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
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
    git git-lfs curl python3 python3-pip jq \
    && git lfs install \
    && pip3 install --no-cache-dir pyyaml \
    && rm -rf /var/lib/apt/lists/*

# Install ClickHouse static binary (pinned version for reproducibility)
ARG CH_VERSION=24.12.3.47
RUN curl -fsSL "https://packages.clickhouse.com/tgz/stable/clickhouse-common-static-${CH_VERSION}-amd64.tgz" \
    | tar xz --strip-components=1 -C /tmp/ \
    && cp /tmp/usr/bin/clickhouse /usr/local/bin/clickhouse \
    && chmod +x /usr/local/bin/clickhouse \
    && rm -rf /tmp/usr

# Install yq — YAML parser for bash
RUN curl -fsSL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
    -o /usr/local/bin/yq && \
    chmod +x /usr/local/bin/yq

WORKDIR /app
COPY . .

# Make scripts executable
RUN chmod +x init_clickhouse.sh refresh_sources.sh

# Create all directories ClickHouse needs — writable by uid 1000 (HF default user)
# Only data directories get 777; scripts stay 755
RUN mkdir -p /app/ch/data /app/ch/tmp /app/ch/user_files /app/ch/format_schemas \
             /app/ch/access /app/ch/log /app/data /app/data/sql_repos && \
    chmod -R 777 /app/ch /app/data

# HF Spaces only exposes this port — gateway sits here
EXPOSE 7860

CMD ["bash", "init_clickhouse.sh"]