@@ -12,6 +12,9 @@ ARG PYATLAN_COMMIT_SHA=""
1212USER root
1313WORKDIR /tmp/build
1414
15+ # Install git and build tools
16+ RUN apk add --no-cache git py3.11-build
17+
1518# Clone pyatlan from GitHub
1619RUN echo "=== Cloning pyatlan from GitHub ===" && \
1720 git clone https://github.com/atlanhq/atlan-python.git /tmp/build/atlan-python
@@ -28,7 +31,13 @@ RUN cd /tmp/build/atlan-python && \
2831 (git checkout "v$PYATLAN_VERSION" || git checkout "$PYATLAN_VERSION"); \
2932 fi && \
3033 echo "Commit: $(git rev-parse HEAD)" && \
31- echo "Version: $(cat pyatlan/version.txt)"
34+ echo "Version: $(cat pyatlan/version.txt)" && \
35+ # Build wheel in builder stage (smaller than copying full source)
36+ python3 -m build --wheel --outdir /tmp/wheels . && \
37+ # Remove everything except the wheel
38+ cd /tmp && \
39+ rm -rf /tmp/build/atlan-python && \
40+ echo "Built wheel: $(ls -lh /tmp/wheels/*.whl)"
3241
3342# ============================================
3443# Stage 2: Final - Runtime image
@@ -66,13 +75,11 @@ RUN apk add --no-cache \
6675 py3.11-pyyaml=6.0.3-r0 \
6776 py3.11-httpx=0.28.1-r2
6877
69- # Install dependencies and pyatlan in ONE layer (copy + install + cleanup)
70- # This prevents Docker from keeping source files in image layers
71- RUN --mount=type=bind,from=builder,source=/tmp/build/atlan-python,target=/mnt/source,readonly \
72- # Copy source to writable location
73- cp -r /mnt/source /tmp/pyatlan-source && \
74- # Install non-APK dependencies
75- uv pip install --system --no-cache \
78+ # Copy only the wheel from builder (much smaller than full source)
79+ COPY --from=builder /tmp/wheels/*.whl /tmp/
80+
81+ # Install dependencies + pyatlan wheel + cleanup in ONE layer
82+ RUN uv pip install --system --no-cache \
7683 lazy_loader~=0.4 \
7784 nanoid~=2.0.0 \
7885 httpx-retries~=0.4.0 && \
0 commit comments