Skip to content

Commit bd40ba6

Browse files
committed
APP-10279 | Publish pyatlan with chainguard golden image for each release
1 parent aba8073 commit bd40ba6

1 file changed

Lines changed: 57 additions & 30 deletions

File tree

Dockerfile.chainguard

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,18 @@ ARG PYATLAN_COMMIT_SHA=""
5454
# Copy version.txt from builder and set PYATLAN_VERSION if not provided
5555
COPY --from=builder /tmp/version.txt /tmp/version.txt
5656
ARG PYATLAN_VERSION
57-
RUN if [ -z "$PYATLAN_VERSION" ]; then \
57+
RUN echo "=== Debug: Version setup ===" && \
58+
echo "Build arg PYATLAN_VERSION: '$PYATLAN_VERSION'" && \
59+
echo "Contents of version.txt: '$(cat /tmp/version.txt)'" && \
60+
if [ -z "$PYATLAN_VERSION" ]; then \
5861
PYATLAN_VERSION=$(cat /tmp/version.txt | tr -d '\n\r'); \
62+
echo "Using version from file: $PYATLAN_VERSION"; \
63+
else \
64+
echo "Using build arg version: $PYATLAN_VERSION"; \
5965
fi && \
60-
echo "Using PYATLAN_VERSION: $PYATLAN_VERSION" && \
61-
echo "$PYATLAN_VERSION" > /tmp/final_version.txt
66+
echo "Final PYATLAN_VERSION: $PYATLAN_VERSION" && \
67+
echo "$PYATLAN_VERSION" > /tmp/final_version.txt && \
68+
echo "Contents of final_version.txt: '$(cat /tmp/final_version.txt)'"
6269

6370
USER root
6471
WORKDIR /app
@@ -69,8 +76,7 @@ ENV UV_NO_MANAGED_PYTHON=true \
6976

7077
# Install pyatlan dependencies from Chainguard APK (hardened packages)
7178
RUN apk add --no-cache \
72-
py3.11-pydantic=2.12.0-r0 \
73-
py3.11-pydantic-core=2.41.1-r0 \
79+
py3.11-pydantic=2.12.5-r0 \
7480
py3.11-jinja2=3.1.6-r1 \
7581
py3.11-tenacity=9.1.2-r2 \
7682
py3.11-pytz=2025.2-r2 \
@@ -83,44 +89,65 @@ COPY --from=builder /tmp/wheels/*.whl /tmp/
8389

8490
# Install dependencies + pyatlan wheel + cleanup in ONE layer
8591
RUN uv pip install --system --no-cache \
86-
lazy_loader~=0.4 \
92+
lazy-loader~=0.4 \
8793
nanoid~=2.0.0 \
94+
authlib~=1.6.0 \
8895
httpx-retries~=0.4.0 && \
89-
# Install pyatlan with --no-deps
90-
cd /tmp/pyatlan-source && \
91-
uv pip install --system --no-cache --no-deps . && \
92-
# Cleanup everything in same layer (source + caches + bytecode)
93-
cd / && rm -rf /tmp/pyatlan-source /root/.cache ~/.cache && \
94-
rm -rf /tmp/version.txt /tmp/final_version.txt && \
96+
# Install pyatlan wheel with --no-deps
97+
uv pip install --system --no-cache --no-deps /tmp/*.whl && \
98+
# Cleanup everything EXCEPT version files (needed for verification)
99+
cd / && rm -rf /tmp/*.whl /root/.cache ~/.cache && \
95100
find /usr/lib/python3.11 -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true && \
96101
find /usr/lib/python3.11 -type f -name '*.pyc' -delete 2>/dev/null || true
97102

98103
# Verify installation and version
99-
RUN EXPECTED_VERSION="$(cat /tmp/final_version.txt)" python3 <<'EOF'
104+
RUN echo "=== Debug: Checking version files ===" && \
105+
ls -la /tmp/ && \
106+
echo "Contents of final_version.txt:" && \
107+
cat /tmp/final_version.txt && \
108+
echo "=== Starting verification ===" && \
109+
EXPECTED_VERSION="$(cat /tmp/final_version.txt)" python3 <<'EOF'
100110
import sys
101111
import os
102-
import pyatlan
103-
from pyatlan.client.atlan import AtlanClient
104112

105113
expected_version = os.environ.get("EXPECTED_VERSION", "unknown")
106-
107114
print("=== Pyatlan Installation Verification ===")
108-
print(f"Installed version: {pyatlan.__version__}")
109-
print(f"Expected version: {expected_version}")
110-
111-
# Version validation (skip if 'latest' was requested)
112-
if expected_version != "latest":
113-
if pyatlan.__version__ != expected_version:
114-
print(f"❌ ERROR: Version mismatch!")
115-
print(f" Expected: {expected_version}")
116-
print(f" Got: {pyatlan.__version__}")
117-
sys.exit(1)
118-
119-
print("✅ Version verified")
120-
print("✅ AtlanClient imported successfully")
121-
print("=== Build verification passed ===")
115+
print(f"Expected version from env: {expected_version}")
116+
117+
try:
118+
import pyatlan
119+
print(f"✅ PyAtlan imported successfully")
120+
print(f"Installed version: {pyatlan.__version__}")
121+
122+
# Try importing AtlanClient
123+
from pyatlan.client.atlan import AtlanClient
124+
print(f"✅ AtlanClient imported successfully")
125+
126+
# Version validation (skip if 'latest' was requested)
127+
if expected_version != "latest" and expected_version != "unknown":
128+
if pyatlan.__version__ != expected_version:
129+
print(f"❌ ERROR: Version mismatch!")
130+
print(f" Expected: {expected_version}")
131+
print(f" Got: {pyatlan.__version__}")
132+
sys.exit(1)
133+
else:
134+
print("✅ Version verified")
135+
else:
136+
print("✅ Version validation skipped (latest or unknown)")
137+
138+
print("=== Build verification passed ===")
139+
140+
except ImportError as e:
141+
print(f"❌ Import error: {e}")
142+
sys.exit(1)
143+
except Exception as e:
144+
print(f"❌ Unexpected error: {e}")
145+
sys.exit(1)
122146
EOF
123147

148+
# Final cleanup of temporary version files
149+
RUN rm -rf /tmp/version.txt /tmp/final_version.txt
150+
124151
# Add build metadata as labels
125152
LABEL python.version="${PYTHON_VERSION}"
126153
LABEL pyatlan.commit_sha="${PYATLAN_COMMIT_SHA}"

0 commit comments

Comments
 (0)