|
| 1 | +# Build args and base image |
| 2 | +ARG build_for=linux/amd64 |
| 3 | +FROM --platform=$build_for python:3.13.1-slim-bullseye |
| 4 | +LABEL maintainer="Kayrnt" |
| 5 | +LABEL description="dbt development environment with BigQuery support" |
| 6 | + |
| 7 | +# Set environment variables for proper encoding and locale |
| 8 | +ENV PYTHONIOENCODING=utf-8 \ |
| 9 | + LANG=en_US.UTF-8 \ |
| 10 | + LANGUAGE=en_US:en \ |
| 11 | + LC_ALL=en_US.UTF-8 |
| 12 | + |
| 13 | +# Install system dependencies and set locale |
| 14 | +# Using --no-install-recommends to minimize image size |
| 15 | +RUN apt-get update -qq \ |
| 16 | + && apt-get upgrade -y \ |
| 17 | + && apt-get install -y --no-install-recommends \ |
| 18 | + build-essential \ |
| 19 | + wget \ |
| 20 | + curl \ |
| 21 | + ca-certificates \ |
| 22 | + git \ |
| 23 | + jq \ |
| 24 | + locales \ |
| 25 | + dumb-init \ |
| 26 | + && echo "UTC" > /etc/localtime \ |
| 27 | + && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ |
| 28 | + && locale-gen \ |
| 29 | + # Install dbt completion script |
| 30 | + && wget -q https://raw.githubusercontent.com/dbt-labs/dbt-completion.bash/master/dbt-completion.bash -O ~/.dbt-completion.bash \ |
| 31 | + && echo 'source ~/.dbt-completion.bash' >> ~/.bash_profile \ |
| 32 | + # Clean up |
| 33 | + && apt-get clean \ |
| 34 | + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 35 | + |
| 36 | +# install Cargo |
| 37 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh \ |
| 38 | + && sh rust.sh -y |
| 39 | + |
| 40 | +# Add Cargo to PATH |
| 41 | +ENV PATH="/root/.cargo/bin:${PATH}" |
| 42 | +RUN cargo |
| 43 | + |
| 44 | +# Update pip and install Python dependencies |
| 45 | +RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel |
| 46 | + |
| 47 | +# Install dbt and related tools |
| 48 | +RUN pip install --no-cache-dir \ |
| 49 | + sqlfluff \ |
| 50 | + sqlfluff-templater-dbt \ |
| 51 | + dbt-bigquery \ |
| 52 | + 'sqlmesh[github,bigquery]' \ |
| 53 | + && rm -rf /usr/local/share/doc /root/.cache/ |
| 54 | + |
| 55 | +WORKDIR /usr/app/ |
| 56 | +ENTRYPOINT ["zsh"] |
0 commit comments