1- FROM linuxbase AS pythonbase
1+ FROM python:3.12
2+
3+ # Set environment variables for localization and timezone settings
4+ ENV LANG=en_US.UTF-8 \
5+ LANGUAGE=en_US:en \
6+ LC_ALL=en_US.UTF-8 \
7+ TZ="America/Chicago" \
8+ DEBIAN_FRONTEND=noninteractive
29
310RUN mkdir /apps
411
512# Set build arguments for cross-compilation
613ARG TARGETARCH
14+ ARG DUCKDB_VERSION="v1.2.2"
715
816# Set environment variables
9- ENV PATH=/venv/bin:$PATH \
10- PATH=/root/.cargo/bin:$PATH \
11- PATH="/root/.local/bin/:$PATH"
17+ ENV PATH=/root/.local/bin:/venv/bin:$PATH
1218
13- # Install uv, curl, and the PostgreSQL client (`psql`)
14- RUN apt-get update && apt-get install -y ca-certificates curl postgresql-client unzip
19+ # Install system dependencies
20+ RUN apt-get update && apt-get install -y --no-install-recommends \
21+ postgresql-client gzip curl && \
22+ rm -rf /var/lib/apt/lists/*
1523
16- # Download UV and MinIO Client (mc) based on architecture
24+ # Install UV (Python package manager)
25+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
26+
27+ # Install MinIO client (architecture-specific)
1728RUN if [ "$TARGETARCH" = "amd64" ]; then \
18- curl -LsSf https://astral.sh/uv/install.sh | sh \
19- && curl -O https://dl.min.io/client/mc/release/linux-amd64/mc \
20- && chmod +x mc \
21- && mv mc /usr/local/bin/; \
29+ curl -O https://dl.min.io/client/mc/release/linux-amd64/mc; \
2230 elif [ "$TARGETARCH" = "arm64" ]; then \
23- curl -LsSf https://astral.sh/uv/install.sh | sh \
24- && curl -O https://dl.min.io/client/mc/release/linux-arm64/mc \
25- && chmod +x mc \
26- && mv mc /usr/local/bin/; \
31+ curl -O https://dl.min.io/client/mc/release/linux-arm64/mc; \
2732 else \
2833 echo "Unsupported architecture: $TARGETARCH" && exit 1; \
29- fi
30-
31- # Install DuckDB
32- ARG DUCKDB_VERSION="v1.2.2"
34+ fi && \
35+ chmod +x mc && \
36+ mv mc /usr/local/bin/mc
3337
34- RUN set -eux; \
35- apt-get update && apt-get install -y --no-install-recommends \
36- curl ca-certificates gzip && \
37- rm -rf /var/lib/apt/lists/* && \
38- # pick the correct pre‑built binary for the platform
39- if [ "$TARGETARCH" = "amd64" ]; then \
38+ # Install DuckDB CLI (architecture-specific)
39+ RUN if [ "$TARGETARCH" = "amd64" ]; then \
4040 DUCKDB_DIST="linux-amd64" ; \
4141 elif [ "$TARGETARCH" = "arm64" ]; then \
4242 DUCKDB_DIST="linux-arm64" ; \
4343 else \
4444 echo "Unsupported architecture: $TARGETARCH" && exit 1; \
4545 fi && \
4646 curl -fsSL "https://github.com/duckdb/duckdb/releases/download/${DUCKDB_VERSION}/duckdb_cli-${DUCKDB_DIST}.gz" \
47- | gunzip -c > /usr/local/bin/duckdb && \
47+ | gunzip -c > /usr/local/bin/duckdb && \
4848 chmod +x /usr/local/bin/duckdb && \
49- duckdb --version # quick sanity check
49+ duckdb --version
5050
51- # Set up a virtual env to use for whatever app is destined for this container.
51+ # Create Python virtual environment
5252RUN uv venv --python 3.12.6 /venv && \
53- echo "\n source /venv/bin/activate\n " >> /root/.zshrc && \
54- uv --version
55-
56- # Copy application-specific files
57- COPY requirements.txt /apps/requirements.txt
53+ /venv/bin/python --version
5854
5955# Run install of requirements
60- RUN . /venv/bin/activate && \
61- uv pip install --upgrade -r /apps/requirements.txt && \
62- uv pip install --upgrade granian[pname]
63-
64- RUN echo "We're good:" && \
65- /venv/bin/python --version
56+ COPY requirements.txt /apps/requirements.txt
57+ RUN uv pip install --upgrade -r /apps/requirements.txt
6658
67- CMD ["tail" , "-f" , "/dev/null" ]
59+ # Keep container running for interactive use
60+ CMD ["tail" , "-f" , "/dev/null" ]
0 commit comments