Spaces:
Sleeping
Sleeping
| 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"] | |