File size: 1,047 Bytes
3fd3eea
 
 
 
 
2fba152
3fd3eea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

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

# Install ClickHouse static binary
RUN curl https://clickhouse.com/ | sh && \
    mv clickhouse /usr/local/bin/ && \
    chmod +x /usr/local/bin/clickhouse

# Install yq — YAML parser for bash (used by refresh_sources.sh)
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)
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 && \
    chmod -R 777 /app

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

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