Skip to content

Commit 13c246e

Browse files
authored
fix: Lambda GPU image OSS compliance and builder consistency (#5739)
1 parent 175db42 commit 13c246e

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

docker/lambda/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ COPY --from=lambda-python /var/lang/lib /var/lang/lib
6868
RUN rm -rf /var/lang/lib/python3.13/site-packages
6969
ENV PATH="/var/lang/bin:$PATH"
7070
COPY ./docker/lambda/requirements-base.txt /tmp/requirements.txt
71-
RUN --mount=type=cache,target=/root/.cache/uv uv pip install --python /var/lang/bin/python3.13 -r /tmp/requirements.txt
71+
RUN --mount=type=cache,target=/root/.cache/uv \
72+
uv pip install --python /var/lang/bin/python3.13 -r /tmp/requirements.txt \
73+
&& uv pip check --python /var/lang/bin/python3.13 \
74+
&& (find /var/lang -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; true) \
75+
&& find /var/lang -type f -name "*.pyc" -delete \
76+
&& find /var/lang -type f -name "*.pyo" -delete
7277

7378
# ============================================================
7479
# CuPy builder (Python 3.13 — awslambdaric, CuPy, NumPy, SciPy, etc.)
@@ -236,6 +241,10 @@ RUN chmod +x /usr/local/bin/deep_learning_container.py \
236241
&& echo 'source /usr/local/bin/bash_telemetry.sh' >>/etc/bashrc \
237242
&& echo 'source /usr/local/bin/bash_telemetry.sh' >>/root/.bashrc \
238243
&& bash /tmp/setup_oss_compliance.sh python3 \
244+
&& printf '\n** FFmpeg; version 6.1 -- https://ffmpeg.org/releases/ffmpeg-6.1.tar.xz\n' >> /root/BUILD_FROM_SOURCE_PACKAGES_LICENCES \
245+
&& printf '\nFFmpeg 6.1 https://ffmpeg.org/releases/ffmpeg-6.1.tar.xz\n' >> /root/THIRD_PARTY_SOURCE_CODE_URLS \
246+
&& printf '\n** FFprobe; version 6.1 -- https://ffmpeg.org/releases/ffmpeg-6.1.tar.xz\n' >> /root/BUILD_FROM_SOURCE_PACKAGES_LICENCES \
247+
&& printf '\nFFprobe 6.1 https://ffmpeg.org/releases/ffmpeg-6.1.tar.xz\n' >> /root/THIRD_PARTY_SOURCE_CODE_URLS \
239248
&& rm /tmp/setup_oss_compliance.sh \
240249
&& rm -rf /var/lang/lib/python3.13/ensurepip/_bundled
241250
WORKDIR /var/task

test/sanity/scripts/upload_oss_source.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,33 @@ def upload_to_s3(s3_client, local_path, s3_key):
4848

4949

5050
def clone_and_tar(name, version, url, work_dir):
51-
"""Clone repo and create tarball. Returns tarball path or None."""
51+
"""Clone repo or download tarball and create tarball. Returns tarball path or None."""
5252
dir_name = f"{name}_v{version}_source_code"
5353
local_dir = os.path.join(work_dir, dir_name)
5454
tarball = f"{local_dir}.tar.gz"
55+
url = url.strip()
56+
is_tarball = url.endswith((".tar.gz", ".tar.xz", ".tar.bz2", ".tgz"))
5557

5658
for attempt in range(MAX_RETRIES):
5759
try:
5860
if not os.path.isdir(local_dir):
59-
subprocess.run(
60-
["git", "clone", url.strip(), local_dir],
61-
check=True,
62-
capture_output=True,
63-
)
61+
if is_tarball:
62+
downloaded = os.path.join(work_dir, os.path.basename(url))
63+
subprocess.run(
64+
["curl", "-fsSL", "-o", downloaded, url], check=True, capture_output=True
65+
)
66+
os.makedirs(local_dir)
67+
subprocess.run(
68+
["tar", "-xf", downloaded, "-C", local_dir, "--strip-components=1"],
69+
check=True,
70+
capture_output=True,
71+
)
72+
else:
73+
subprocess.run(
74+
["git", "clone", url, local_dir], check=True, capture_output=True
75+
)
6476
subprocess.run(
65-
["tar", "-czf", tarball, "-C", work_dir, dir_name],
66-
check=True,
67-
capture_output=True,
77+
["tar", "-czf", tarball, "-C", work_dir, dir_name], check=True, capture_output=True
6878
)
6979
return tarball
7080
except Exception as e:

0 commit comments

Comments
 (0)