diff --git a/ATTRIBUTIONS-container.md b/ATTRIBUTIONS-container.md new file mode 100644 index 00000000..8e297857 --- /dev/null +++ b/ATTRIBUTIONS-container.md @@ -0,0 +1,60 @@ + + +# Container Third-Party Software Attributions + +This document provides attribution information for third-party software components included in the aiperf runtime container. + +## Software Components + +### FFmpeg + +**Component Information:** +- **Software**: FFmpeg +- **Version**: 7.1 +- **Website**: https://ffmpeg.org/ +- **License**: LGPL v2.1+ +- **Usage**: Video and audio processing library (included in runtime container) +- **Build Configuration**: Built without GPL components (`--disable-gpl --disable-nonfree`) + +**License Text:** + +> FFmpeg is licensed under the GNU Lesser General Public License (LGPL) version 2.1 or later. +> +> This library is free software; you can redistribute it and/or +> modify it under the terms of the GNU Lesser General Public +> License as published by the Free Software Foundation; either +> version 2.1 of the License, or (at your option) any later version. +> +> This library is distributed in the hope that it will be useful, +> but WITHOUT ANY WARRANTY; without even the implied warranty of +> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +> Lesser General Public License for more details. +> +> Full license text: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +**Source Code Availability:** + +The FFmpeg source code used to build this container is available at: +- Official release: https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz +- Our build configuration is documented in the Dockerfile + +**Compliance Notes:** + +- FFmpeg is dynamically linked and can be replaced by users +- No FFmpeg source code modifications were made +- Build configuration excludes GPL-licensed components +- Apache 2.0 licensed code in this project remains separate from LGPL components + +## License Compatibility + +This project uses the Apache 2.0 license for its original code. The FFmpeg library included in the runtime container is licensed under LGPL v2.1+, which is compatible with Apache 2.0 when: +- FFmpeg is dynamically linked (not statically linked) +- FFmpeg binaries can be replaced by users +- No modifications were made to FFmpeg source code +- Proper attribution is provided (as above) + +--- +*Last updated: October 30, 2025* diff --git a/ATTRIBUTIONS.md b/ATTRIBUTIONS.md index 3c1b2363..fb28357c 100644 --- a/ATTRIBUTIONS.md +++ b/ATTRIBUTIONS.md @@ -1,3 +1,8 @@ + + # Third-Party Asset Attributions This document provides attribution information for public domain assets used in this project. @@ -21,7 +26,7 @@ This document provides attribution information for public domain assets used in ### Getty Museum Images **Asset Information:** -- **Files**: +- **Files**: - [`aiperf/dataset/generator/assets/source_images/0bfd8fdf-457f-43c8-9253-a2346d37d26a_1024.jpg`](aiperf/dataset/generator/assets/source_images/0bfd8fdf-457f-43c8-9253-a2346d37d26a_1024.jpg) - [Object 103QTD](https://www.getty.edu/art/collection/object/103QTD) - [`aiperf/dataset/generator/assets/source_images/119544eb-9bbf-47d1-8d93-a51de6370295_861.jpg`](aiperf/dataset/generator/assets/source_images/119544eb-9bbf-47d1-8d93-a51de6370295_861.jpg) - [Object 103SNG](https://www.getty.edu/art/collection/object/103SNG) - [`aiperf/dataset/generator/assets/source_images/1ba066e0-7291-4ef4-8a6e-e8724af7f046_865.jpg`](aiperf/dataset/generator/assets/source_images/1ba066e0-7291-4ef4-8a6e-e8724af7f046_865.jpg) - [Object 10962M](https://www.getty.edu/art/collection/object/10962M) @@ -32,9 +37,9 @@ This document provides attribution information for public domain assets used in **License Text:** > Creative Commons Legal Code -> +> > CC0 1.0 Universal -> +> > CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE > LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN > ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS @@ -43,14 +48,14 @@ This document provides attribution information for public domain assets used in > PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM > THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED > HEREUNDER. -> +> > Statement of Purpose -> +> > The laws of most jurisdictions throughout the world automatically confer > exclusive Copyright and Related Rights (defined below) upon the creator > and subsequent owner(s) (each and all, an "owner") of an original work of > authorship and/or a database (each, a "Work"). -> +> > Certain owners wish to permanently relinquish those rights to a Work for > the purpose of contributing to a commons of creative, cultural and > scientific works ("Commons") that the public can reliably and without fear @@ -61,7 +66,7 @@ This document provides attribution information for public domain assets used in > culture and the further production of creative, cultural and scientific > works, or to gain reputation or greater distribution for their Work in > part through the use and efforts of others. -> +> > For these and/or other purposes and motivations, and without any > expectation of additional consideration or compensation, the person > associating CC0 with a Work (the "Affirmer"), to the extent that he or she @@ -69,12 +74,12 @@ This document provides attribution information for public domain assets used in > elects to apply CC0 to the Work and publicly distribute the Work under its > terms, with knowledge of his or her Copyright and Related Rights in the > Work and the meaning and intended legal effect of CC0 on those rights. -> +> > 1. Copyright and Related Rights. A Work made available under CC0 may be > protected by copyright and related or neighboring rights ("Copyright and > Related Rights"). Copyright and Related Rights include, but are not > limited to, the following: -> +> > i. the right to reproduce, adapt, distribute, perform, display, > communicate, and translate a Work; > ii. moral rights retained by the original author(s) and/or performer(s); @@ -92,7 +97,7 @@ This document provides attribution information for public domain assets used in > vii. other similar, equivalent or corresponding rights throughout the > world based on applicable law or treaty, and any national > implementations thereof. -> +> > 2. Waiver. To the greatest extent permitted by, but not in contravention > of, applicable law, Affirmer hereby overtly, fully, permanently, > irrevocably and unconditionally waives, abandons, and surrenders all of @@ -109,7 +114,7 @@ This document provides attribution information for public domain assets used in > revocation, rescission, cancellation, termination, or any other legal or > equitable action to disrupt the quiet enjoyment of the Work by the public > as contemplated by Affirmer's express Statement of Purpose. -> +> > 3. Public License Fallback. Should any part of the Waiver for any reason > be judged legally invalid or ineffective under applicable law, then the > Waiver shall be preserved to the maximum extent permitted taking into @@ -131,9 +136,9 @@ This document provides attribution information for public domain assets used in > Rights in the Work or (ii) assert any associated claims and causes of > action with respect to the Work, in either case contrary to Affirmer's > express Statement of Purpose. -> +> > 4. Limitations and Disclaimers. -> +> > a. No trademark or patent rights held by Affirmer are waived, abandoned, > surrendered, licensed or otherwise affected by this document. > b. Affirmer offers the Work as-is and makes no representations or @@ -156,7 +161,7 @@ This document provides attribution information for public domain assets used in ## Usage Summary - **All assets are public domain** - no legal restrictions on use -- **No attribution legally required** but recommended as good practice +- **No attribution legally required** but recommended as good practice - **Compatible with Apache 2.0** license used by this project - **No endorsement implied** by original sources diff --git a/Dockerfile b/Dockerfile index 401cf655..b2430a1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -FROM python:3.12-slim AS base +FROM python:3.12-slim-bookworm AS base ENV USERNAME=appuser ENV APP_NAME=aiperf @@ -12,6 +12,15 @@ RUN groupadd -r $USERNAME \ # Install uv COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +# Create virtual environment +RUN mkdir /opt/$APP_NAME \ + && uv venv /opt/$APP_NAME/venv --python 3.12 \ + && chown -R $USERNAME:$USERNAME /opt/$APP_NAME + +# Activate virtual environment +ENV VIRTUAL_ENV=/opt/$APP_NAME/venv +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" + ####################################### ########## Local Development ########## ####################################### @@ -54,32 +63,95 @@ RUN mkdir -p /home/$USERNAME/.cache/ ENTRYPOINT ["/bin/bash"] ############################################ -############# Final Build ################## +############ Wheel Builder ################# ############################################ -FROM base AS final +FROM base AS wheel-builder -# Create virtual environment -RUN mkdir /opt/$APP_NAME \ - && uv venv /opt/$APP_NAME/venv --python 3.12 \ - && chown -R $USERNAME:$USERNAME /opt/$APP_NAME +WORKDIR /workspace -# Activate virtual environment -ENV VIRTUAL_ENV=/opt/$APP_NAME/venv -ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" +# Copy the entire application +COPY . /workspace -### INSTALLATION ### +# Build the wheel +RUN uv build --wheel --out-dir /dist -# Copy pyproject first for better layer caching -COPY pyproject.toml . +############################################ +############# Env Builder ################## +############################################ +FROM base AS env-builder + +WORKDIR /workspace + +# Build ffmpeg from source +RUN apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + build-essential \ + nasm \ + pkg-config \ + wget \ + yasm \ + && rm -rf /var/lib/apt/lists/* + +# Download and build ffmpeg +RUN wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz \ + && tar -xf ffmpeg-7.1.tar.xz \ + && cd ffmpeg-7.1 \ + && ./configure \ + --prefix=/opt/ffmpeg \ + --disable-gpl \ + --disable-nonfree \ + --enable-shared \ + --disable-static \ + --disable-doc \ + --disable-htmlpages \ + --disable-manpages \ + --disable-podpages \ + --disable-txtpages \ + && make -j$(nproc) \ + && make install \ + && cd .. \ + && rm -rf ffmpeg-7.1 ffmpeg-7.1.tar.xz + +# Create directories for the nvs user (UID 1000 in NVIDIA distroless) +RUN mkdir -p /app /app/artifacts /app/.cache \ + && chown -R 1000:1000 /app \ + && chmod -R 755 /app # Install only the dependencies using uv +COPY pyproject.toml . RUN uv sync --active --no-install-project # Copy the rest of the application -COPY . . +COPY --from=wheel-builder /dist /dist +RUN uv pip install /dist/aiperf-*.whl \ + && rm -rf /dist /workspace/pyproject.toml + +############################################ +############# Runtime Image ################ +############################################ +FROM nvcr.io/nvidia/distroless/python:3.12-v3.4.17-dev AS runtime + +# Include license and attribution files +COPY LICENSE ATTRIBUTIONS.md ATTRIBUTIONS-container.md /legal/ + +# Copy bash with executable permissions preserved using --chmod +COPY --from=env-builder --chown=1000:1000 --chmod=755 /bin/bash /bin/bash + +# Copy ffmpeg binaries and libraries +COPY --from=env-builder --chown=1000:1000 /opt/ffmpeg /opt/ffmpeg +ENV PATH="/opt/ffmpeg/bin:${PATH}" \ + LD_LIBRARY_PATH="/opt/ffmpeg/lib:${LD_LIBRARY_PATH}" + +# Setup the directories with permissions for nvs user +COPY --from=env-builder --chown=1000:1000 /app /app +WORKDIR /app +ENV HOME=/app + +# Copy the virtual environment and set up +COPY --from=env-builder --chown=1000:1000 /opt/aiperf/venv /opt/aiperf/venv -# Install the project -RUN uv sync --active --no-dev +ENV VIRTUAL_ENV=/opt/aiperf/venv \ + PATH="/opt/aiperf/venv/bin:${PATH}" -# Command to run the application -ENTRYPOINT ["aiperf"] +# Set bash as entrypoint +ENTRYPOINT ["/bin/bash", "-c"] \ No newline at end of file