FROM python:3.13-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# System dependencies for building Python packages
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential gcc libffi-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install build tooling for Flit-based packages
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel
RUN python -m pip install --no-cache-dir flit_core>=3.11,<4
# Copy source
COPY . .
# Install the package from source
RUN pip install --no-cache-dir .
# Simple smoke test to verify installation (will run on container start)
CMD ["python", "-c", "import pypdf; print(pypdf.__version__)" ]
# Exclude VCS metadata .git # Python cache and build artifacts __pycache__/ *.pyc *.pyo *.pyd *.class # Virtual environments venv/ env/ ENV/ .env/ # Build artifacts build/ dist/ *.egg-info/ # Pytest / caches .pytest_cache/ .mypy_cache/ .coverage* # Documentation and tests (not needed for runtime image) docs/ tests/ .GitHub/ .gitrepo/ # Misc *.log *.tmp *.swp *.DS_Store # Node modules (not used here but common in ignore lists) node_modules/
- Exact error message and exit code - /bin/sh: 1: cannot open 4: No such file - ERROR: failed to build: failed to solve: process "/bin/sh -c python -m pip install --no-cache-dir flit_core>=3.11,<4" did not complete successfully: exit code: 2 - Failing command/step - [5/7] RUN python -m pip install --no-cache-dir flit_core>=3.11,<4 - Missing packages or files mentioned - The error arises because the shell treats "<4" as input redirection and tries to open a file named "4"; file "4" does not exist. - No actual package/file download failure is shown for flit_core; the issue is shell redirection due to the unquoted version spec flit_core>=3.11,<4. - Version mismatch info - No explicit version-mismatch error is reported. The version constraint flit_core>=3.11,<4 is present, but the failure is caused by shell interpretation of "<". - Context note - Base image shown earlier is python:3.13-slim; the failure occurs at the step attempting to install flit_core with a version range.
FROM python:3.13-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# System dependencies for building Python packages
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential gcc libffi-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install build tooling for Flit-based packages
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel
RUN python -m pip install --no-cache-dir "flit_core>=3.11,<4"
# Copy source
COPY . .
# Install the package from source
RUN pip install --no-cache-dir .
# Simple smoke test to verify installation (will run on container start)
CMD ["python", "-c", "import pypdf; print(pypdf.__version__)" ]
Concerns: Base image tag 3.13-slim may not exist or be publicly published yet; using a non-released or unavailable Python tag could cause build failures., Final image bundles build tools (build-essential, gcc, libffi-dev) which increases size; consider a multi-stage build or cleaning steps to remove build dependencies after installation. Smoke [FAIL]: python -c \"import pypdf; print(pypdf.__version__)\ Output: sh: 1: Syntax error: word unexpected (expecting ")") Smoke [FAIL]: python -c \"import pypdf; print(pypdf.__name__)\ Output: sh: 1: Syntax error: word unexpected (expecting ")")
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# System dependencies for building Python packages
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential gcc libffi-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install build tooling for Flit-based packages
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel
RUN python -m pip install --no-cache-dir "flit_core>=3.11,<4"
# Copy source
COPY . .
# Install the package from source
RUN pip install --no-cache-dir .
# Simple smoke test to verify installation (will run on container start)
CMD ["python", "-c", "import pypdf; print(pypdf.__version__)" ]
Concerns: COPY . . may copy unnecessary files; consider adding a .dockerignore to avoid shipping tests or large files, The CMD test assumes the package name is pypdf; ensure this matches the actual package being installed from source Smoke [FAIL]: python -c "import pypdf; print(pypdf.__version__) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# System dependencies for building Python packages
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential gcc libffi-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install build tooling for Flit-based packages
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel
RUN python -m pip install --no-cache-dir "flit_core>=3.11,<4"
# Copy source
COPY . .
# Install the package from source
RUN pip install --no-cache-dir .
# Create a small verification script to run at container start
RUN printf 'import pypdf\nprint(pypdf.__version__)\n' > /app/verify.py
# Simple smoke test to verify installation (will run on container start)
CMD ["python", "/app/verify.py"]
Concerns: Image retains build-needed packages (build-essential, gcc, libffi-dev) after install, increasing final image size. Consider multi-stage build or cleanup to slim image., COPY . . may bring in non-packaging files (like tests or docs) unless a .dockerignore is used. Adding a .dockerignore would reduce unnecessary context., Smoke test verifies only import/version; does not exercise actual PDF functionality. Consider adding a minimal runtime test (e.g., reading a small PDF) if feasible. Smoke [FAIL]: python -c 'import pypdf; print(pypdf.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import pypdf; print(hasattr(pypdf, "PdfReader")) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: python /app/verify.py
# Use a lightweight Python base image
FROM python:3.12-slim
# Prevent Python from writing pyc files and ensure stdout is unbuffered
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy metadata and source
COPY pyproject.toml ./
COPY pypdf ./pypdf
# Install the package from source
RUN python -m pip install --upgrade pip && \
python -m pip install .
# Simple smoke test to verify the install
CMD ["python", "-c", "import pypdf, sys; print('pypdf', pypdf.__version__); print('Python', sys.version)"]
Summary (under 1500 chars): - Failing step: [5/5] RUN python -m pip install --upgrade pip && python -m pip install . - Exit code: 1 - Exact error messages: - FileNotFoundError: [Errno 2] No such file or directory: 'README.md' - flit_core.config.ConfigError: Description file README.md does not exist - ERROR: Failed to build 'file:///app' when getting requirements to build wheel - Missing packages or files mentioned: - README.md is missing; the build expects a README.md for the package description (pep621 metadata via flit_core) - Version mismatch / changes observed: - Pip is upgraded within the RUN: updated from 25.0.1 to 26.0.1 (pip 25.0.1 installed, then uninstalled, then pip-26.0.1 installed) - Run includes a root-user warnings note about pip - Context notes: - Base image used is python:3.12-slim - The error originates during building wheel requirements for the project in /app due to missing README.md referenced by flit_core's pep621 metadata.
# Use a lightweight Python base image
FROM python:3.12-slim
# Prevent Python from writing pyc files and ensure stdout is unbuffered
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy minimal project files needed to install from source
COPY README.md ./README.md
COPY pyproject.toml ./pyproject.toml
COPY LICENSE ./LICENSE || true
COPY pypdf ./pypdf
COPY resources ./resources
# Install dependencies and build the package from source
RUN python -m pip install --upgrade pip && \
python -m pip install .
# Smoke test of the installed package
CMD ["python", "-c", "import pypdf, sys; print('pypdf', pypdf.__version__); print('Python', sys.version)"]
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 717B done #1 DONE 0.1s #2 [internal] load metadata for docker.io/library/python:3.12-slim #2 DONE 0.3s #3 [internal] load .dockerignore #3 transferring context: 493B done #3 DONE 0.1s #4 [1/8] FROM docker.io/library/python:3.12-slim@sha256:3d5ed973e45820f5ba5e46bd065bd88b3a504ff0724d85980dcd05eab361fcf4 #4 resolve docker.io/library/python:3.12-slim@sha256:3d5ed973e45820f5ba5e46bd065bd88b3a504ff0724d85980dcd05eab361fcf4 0.1s done #4 CANCELED #5 [internal] load build context #5 transferring context: 13.57MB 0.1s done #5 DONE 0.3s #6 [2/8] WORKDIR /app #6 CACHED #7 [3/8] COPY README.md ./README.md #7 CACHED #8 [4/8] COPY pyproject.toml ./pyproject.toml #8 CACHED #9 [5/8] COPY LICENSE ./LICENSE || true #9 ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::86szpfzsaoe65gm8zvifwhlaw: "/||": not found ------ > [5/8] COPY LICENSE ./LICENSE || true: ------ Dockerfile:13 -------------------- 11 | COPY README.md ./README.md 12 | COPY pyproject.toml ./pyproject.toml 13 | >>> COPY LICENSE ./LICENSE || true 14 | COPY pypdf ./pypdf 15 | COPY resources ./resources -------------------- ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::86szpfzsaoe65gm8zvifwhlaw: "/||": not found
FROM python:3.12-slim
# Basic environment settings
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy minimal project files needed for installation
COPY README.md .
COPY pyproject.toml .
COPY pypdf ./pypdf
COPY resources ./resources
COPY LICENSE ./LICENSE
# Install build tools and install the package from source
RUN python -m pip install --upgrade pip setuptools wheel && \
python -m pip install .
# Smoke test to verify the installation at runtime
CMD ["python", "-c", "import pypdf, sys; print('pypdf', pypdf.__version__); print('Python', sys.version)"]
Smoke [FAIL]: python -c 'import pypdf, sys; print("pypdf", pypdf.__version__); print("Python", sys.version)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import pypdf; print(pypdf.__version__)
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.12-slim
# Basic environment settings
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy minimal project files needed to install from source
COPY README.md ./README.md
COPY pyproject.toml ./pyproject.toml
COPY pypdf ./pypdf
COPY resources ./resources
# Build and install the package from source
RUN python -m pip install --upgrade pip setuptools wheel && \
python -m pip install .
# Smoke test to verify the installation at runtime
CMD ["python", "-c", "import pypdf, sys; print('pypdf', pypdf.__version__); print('Python', sys.version)"]
- Exact error message and exit code - flit_core.config.ConfigError: No files found for [project.license-files]: 'LICENSE' pattern - ERROR: Failed to build 'file:///app' when getting requirements to build wheel - did not complete successfully: exit code: 1 - Failing command/step - RUN python -m pip install --upgrade pip setuptools wheel && python -m pip install . - Missing packages or files mentioned - No files found for [project.license-files]: 'LICENSE' pattern - Likely missing LICENSE file(s) expected by the project (license-files patterns in pyproject.toml) - Version mismatch info - Base image: python:3.12-slim (Python 3.12 in the build environment) - The failure is due to a packaging metadata issue (license-files) rather than a runtime version mismatch; the flit_core check failing on missing LICENSE files. Notable related versions: pip 26.0.1, setuptools 82.0.1, wheel 0.46.3 (as shown in the build), but the root cause is the missing license file.
FROM python:3.12-slim
# Basic environment settings
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install build tools (only temporary)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential gcc libffi-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy essential project files for a source install
COPY LICENSE ./LICENSE
COPY README.md ./README.md
COPY pyproject.toml ./pyproject.toml
COPY pypdf ./pypdf
# Install dependencies and build the package from source
RUN python -m pip install --upgrade pip setuptools wheel && \
python -m pip install . && \
# Clean up build tools to reduce image size
apt-get purge -y --auto-remove build-essential gcc libffi-dev libssl-dev && \
rm -rf /var/lib/apt/lists/*
# Smoke test to verify the installation at runtime
CMD ["python", "-c", "import pypdf, sys; print('pypdf', pypdf.__version__); print('Python', sys.version)" ]
Concerns: smoke test relies on pypdf.__version__ in the CMD; if the project does not expose __version__, the runtime check could fail or be misleading, no explicit tests for a simple API usage (e.g., opening a PDF with PdfReader) to validate runtime behavior beyond import
Smoke [FAIL]: python -c 'import pypdf; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import pypdf, sys; print("Python", sys.version.split()[0])
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.12-slim
# Basic environment settings
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy essential project files for installation
COPY README.md ./README.md
COPY pyproject.toml ./pyproject.toml
COPY pypdf ./pypdf
COPY resources ./resources
COPY LICENSE ./LICENSE
COPY verify.py ./verify.py
# Install build tools are not strictly required for pure Python, but we'll ensure wheel support
RUN python -m pip install --upgrade pip setuptools wheel && \
python -m pip install .
# Smoke test via a small script to verify installation
CMD ["python", "verify.py"]
# Ignore python bytecode and caches __pycache__/ *.pyc *.pyo *.pyd # Virtual environments venv/ .env/ ENV/ .envs/ # Build artifacts build/ dist/ *.egg-info/ # Tests and docs tests/ docs/ *.pdf # Git data .git/ **/.git/ # Local tooling .coverage .cache .tox # PyPI related *.whl *.tar.gz # OS files .DS_Store
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 638B done #1 DONE 0.1s #2 [internal] load metadata for docker.io/library/python:3.12-slim #2 DONE 0.2s #3 [internal] load .dockerignore #3 transferring context: 357B done #3 DONE 0.1s #4 [1/9] FROM docker.io/library/python:3.12-slim@sha256:3d5ed973e45820f5ba5e46bd065bd88b3a504ff0724d85980dcd05eab361fcf4 #4 resolve docker.io/library/python:3.12-slim@sha256:3d5ed973e45820f5ba5e46bd065bd88b3a504ff0724d85980dcd05eab361fcf4 0.1s done #4 DONE 0.2s #5 [2/9] WORKDIR /app #5 ... #6 [internal] load build context #6 transferring context: 13.57MB 0.1s done #6 DONE 1.1s #5 [2/9] WORKDIR /app #5 ... #7 [3/9] COPY README.md ./README.md #7 CACHED #8 [4/9] COPY pyproject.toml ./pyproject.toml #8 CACHED #9 [5/9] COPY pypdf ./pypdf #9 CACHED #10 [6/9] COPY resources ./resources #10 CACHED #11 [7/9] COPY LICENSE ./LICENSE #11 CACHED #12 [8/9] COPY verify.py ./verify.py #12 ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::4cl5496d6jys6r0q5yv5xtr18: "/verify.py": not found #5 [2/9] WORKDIR /app #5 DONE 2.1s ------ > [8/9] COPY verify.py ./verify.py: ------ Dockerfile:15 -------------------- 13 | COPY resources ./resources 14 | COPY LICENSE ./LICENSE 15 | >>> COPY verify.py ./verify.py 16 | 17 | # Install build tools are not strictly required for pure Python, but we'll ensure wheel support -------------------- ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::4cl5496d6jys6r0q5yv5xtr18: "/verify.py": not found
import pypdf, sys
print('pypdf_version', getattr(pypdf, '__version__', 'unknown'))
print('python_version', sys.version.split()[0])
Smoke [FAIL]: python -c 'import pypdf; print("pypdf ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [PASS]: python -m pip show pypdfFROM python:3.12-slim as builder
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /build
# Minimal files required to build from source
COPY README.md ./README.md
COPY pyproject.toml ./pyproject.toml
COPY LICENSE ./LICENSE
COPY pypdf ./pypdf
COPY resources ./resources
# Build wheel for distribution
RUN python -m pip install --upgrade pip setuptools wheel && \
python -m pip wheel . -w dist
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install the built wheel
COPY --from=builder /build/dist/*.whl /tmp/
RUN python -m pip install --no-cache-dir /tmp/*.whl
# Smoke test script to verify runtime
COPY verify.py ./verify.py
CMD ["python", "./verify.py"]
Concerns: Wildcard wheel copy in COPY --from=builder /build/dist/*.whl /tmp/ may select multiple wheels; ensure only a single wheel is produced or pin the wheel filename., verify.py must be present in the build context for the final CMD to run; consider adding a test or placeholder to avoid runtime failure if missing. Smoke [FAIL]: python -c 'import pypdf; print(pypdf.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'from pypdf import PdfReader; print(PdfReader) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.12-slim as builder ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /build # Copy minimal sources needed to build the wheel COPY README.md ./README.md COPY pyproject.toml ./pyproject.toml COPY LICENSE ./LICENSE COPY pypdf ./pypdf COPY resources ./resources # Build wheel RUN python -m pip install --upgrade pip setuptools wheel RUN python -m pip wheel . -w dist FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # Install the built wheel COPY --from=builder /build/dist/*.whl /tmp/ RUN python -m pip install --no-cache-dir /tmp/*.whl # Verification script to confirm runtime COPY verify.py ./verify.py CMD ["python", "./verify.py"]
Smoke [FAIL]: python -c 'import pypdf; print(pypdf.__version__) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.12-slim as builder ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /build # Copy minimal sources needed to build a wheel from source COPY pyproject.toml ./pyproject.toml COPY README.md ./README.md COPY LICENSE ./LICENSE COPY pypdf ./pypdf COPY resources ./resources # Build wheel RUN python -m pip install --upgrade pip setuptools wheel RUN python -m pip wheel . -w dist FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # Install the built wheel from the builder stage COPY --from=builder /build/dist/*.whl /tmp/ RUN python -m pip install --no-cache-dir /tmp/*.whl # Verification script to confirm runtime COPY verify.py ./verify.py CMD ["python", "./verify.py"]
Smoke [FAIL]: python -c 'import pypdf; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import pypdf, sys; print(pypdf.__name__, getattr(pypdf, "__version__", "n/a"))
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.12-slim as builder ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /build # Copy minimal sources needed to build wheel COPY pyproject.toml ./pyproject.toml COPY README.md ./README.md COPY pypdf ./pypdf RUN mkdir -p dist # Build wheel RUN python -m pip install --upgrade pip setuptools wheel RUN python -m pip wheel . -w dist FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # Install built wheel COPY --from=builder /build/dist/*.whl /tmp/ RUN python -m pip install --no-cache-dir /tmp/*.whl # Basic runtime check: just print version from installed package on startup CMD ["python", "-c", "import pypdf, sys; print(pypdf.__version__ if hasattr(pypdf, '__version__') else 'no-version'); print( sys.version.split()[0] )"]
Error summary - Exact error message and exit code - ERROR: Failed to build 'file:///build' when getting requirements to build wheel - process "/bin/sh -c python -m pip wheel . -w dist" did not complete successfully: exit code: 1 - flit_core.config.ConfigError: No files found for [project.license-files]: 'LICENSE' pattern - Failing command/step - RUN python -m pip wheel . -w dist (builder 8/8) - Missing packages or files mentioned - Missing license file(s) referenced by the build: No files found for [project.license-files]: 'LICENSE' pattern - LICENSE file (or files matching the pattern) not found in the project root - Version mismatch information - Base image used: python:3.12-slim - No explicit version mismatch reported; the failure is due to missing LICENSE files required by flit_core when building the wheel.
FROM python:3.12-slim AS builder ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /build # Copy project sources for wheel building COPY pyproject.toml ./pyproject.toml COPY README.md ./README.md COPY LICENSE ./LICENSE COPY pypdf ./pypdf COPY resources ./resources # Ensure license inside the package directory for flit RUN mkdir -p pypdf && cp LICENSE pypdf/LICENSE # Build wheel RUN python -m pip install --upgrade pip setuptools wheel RUN python -m pip wheel . -w dist FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # Install the built wheel from builder stage COPY --from=builder /build/dist/*.whl /tmp/ RUN python -m pip install --no-cache-dir /tmp/*.whl # Verification script to confirm runtime COPY verify.py ./verify.py CMD ["python", "./verify.py"]
Concerns: COPY --from=builder /build/dist/*.whl /tmp/ may rely on glob expansion across stages; ensure the Docker version used supports globs in multi-stage COPY, or replace with an explicit wheel filename or copy the entire dist directory and reference the wheel reliably.
Smoke [FAIL]: python -c "import pypdf; print('ok')
Output: sh: 1: Syntax error: Unterminated quoted string# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist/*.whl /tmp/pypdf.whl
RUN python -m pip install --no-cache-dir /tmp/pypdf.whl && rm -f /tmp/pypdf.whl
# Smoke test to verify installation works
CMD ["python", "-c", "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))"]
# Docker build context ignore rules .git .gitignore __pycache__/ *.pyc *.pyo *.pyd *.swp *.swo build/ dist/ *.egg-info/ .eggs/ *.egg *.egg-info/ .cache/ .vscode/ .env venv/ ENV/ env/ venvs/ .Python *.tox .tox/ *.pytest_cache/ .tests_cache/ docs/_build/ sample-files/.github/ node_modules/ # Optional - ignore test caches tests/pdf_cache/
- Exact error message and exit code - ERROR: pypdf.whl is not a valid wheel filename. - Exit code: 1 - Failing command/step - [runtime 4/4] RUN python -m pip install --no-cache-dir /tmp/pypdf.whl && rm -f /tmp/pypdf.whl - Missing packages or files mentioned - The builder stage produced a wheel with a proper filename (e.g., pypdf-6.9.2-py3-none-any.whl) in dist/. - The runtime copies it as /tmp/pypdf.whl via COPY --from=builder /workspace/dist/*.whl /tmp/pypdf.whl, resulting in a file named pypdf.whl. - The error occurs because pypdf.whl is not a valid wheel filename (Wheel filenames must follow the distribution-version-python-tag-abi-tag-platform-tag pattern). - Version mismatch / naming detail - The wheel’s actual filename in the builder is pypdf-6.9.2-py3-none-any.whl, but the runtime then uses /tmp/pypdf.whl (an invalid wheel filename), triggering the pip validation error. - No explicit Python/pip version mismatch is reported as the root cause; the issue is the invalid wheel filename after copy.
# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test to verify installation works
CMD ["python", "-c", "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))"]
Smoke [FAIL]: python -c \"import pypdf; print('pypdf version:', pypdf.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test to verify installation works
CMD ["python", "-c", "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))"]
# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test to verify installation works
CMD ["python", "-c", "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))"]
Smoke [FAIL]: python -c "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import pypdf; print('has_PdfReader', hasattr(pypdf, 'PdfReader'))
Output: sh: 1: Syntax error: Unterminated quoted string# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test to verify installation works
CMD ["python", "-c", "import pypdf, sys; print(\"pypdf\", getattr(pypdf, \"__version__\", \"unknown\"))"]
Smoke [FAIL]: python -c "import pypdf, sys; print('pypdf version:', getattr(pypdf, '__version__', 'unknown'))
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import pypdf; print('module path:', pypdf.__file__)
Output: sh: 1: Syntax error: Unterminated quoted string# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test script to verify installation works without shell-quoting issues
RUN bash -lc 'cat > /app/smoke.py << "PY"\nimport pypdf, sys\nprint("pypdf", getattr(pypdf, "__version__", "unknown"))\nPY'
# Run smoke test script on container start
CMD ["python", "smoke.py"]
- Failing step (exactly as in logs)
[runtime 5/5] RUN bash -lc 'cat > /app/smoke.py << "PY"\nimport pypdf, sys\nprint("pypdf", getattr(pypdf, "__version__", "unknown"))\nPY'
- Exact error message and exit code
0.182 bash: line 1: warning: here-document at line 1 delimited by end-of-file (wanted `PYnimport')
0.182 bash: -c: line 1: syntax error near unexpected token `('
0.182 bash: -c: `cat > /app/smoke.py << "PY"\nimport pypdf, sys\nprint("pypdf", getattr(pypdf, "__version__", "unknown"))\nPY'
------
ERROR: failed to build: failed to solve: process "/bin/sh -c bash -lc 'cat > /app/smoke.py << \"PY\"\\nimport pypdf, sys\\nprint(\"pypdf\", getattr(pypdf, \"__version__\", \"unknown\"))\\nPY'" did not complete successfully: exit code: 2
- Failing command/step
RUN bash -lc 'cat > /app/smoke.py << "PY"\nimport pypdf, sys\nprint("pypdf", getattr(pypdf, "__version__", "unknown"))\nPY'
- Missing packages or files mentioned
No specific missing package/file is stated. The failure is due to an invalid here-document in the shell command used to create /app/smoke.py, causing a syntax error.
- Version mismatch info
None reported. The wheel for pypdf was built earlier in the log (pypdf-6.9.2-py3-none-any.whl), but that success is not relevant to the failure here.# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test to verify installation works (exec form to avoid shell quoting issues)
CMD ["python", "-c", "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))"]
Smoke [FAIL]: python -c \"import pypdf; print('pypdf version:', getattr(pypdf, '__version__', 'unknown'))\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import pypdf; print('pypdf path:', pypdf.__file__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Smoke test script to verify installation works (exec form to avoid shell quoting issues)
RUN bash -lc 'printf "import pypdf\nprint(pypdf.__version__)\n" > /app/smoke.py'
# Run smoke test script on container start
CMD ["python", "smoke.py"]
Smoke [FAIL]: python -c 'import pypdf; print(pypdf.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: python -m pip show pypdf Smoke [FAIL]: python -c 'from pypdf import PdfReader; print(PdfReader) Output: sh: 1: Syntax error: Unterminated quoted string
# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheels from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /workspace/dist /workspace/dist
RUN python -m pip install --no-cache-dir /workspace/dist/*.whl
# Prepare a simple smoke test script to verify installation without shell quoting issues
RUN printf 'import pypdf, sys\nprint("pypdf", getattr(pypdf, "__version__", "unknown"))\n' > /app/smoke.py
# Run smoke test script on container start
CMD ["python", "/app/smoke.py"]
Concerns: The build step relies on pyproject.toml and a valid wheel; if the project uses a non-wheel distribution or missing dependencies, the build may fail in the builder stage., The runtime smoke test only validates that the package can be imported and exposes a __version__ attribute; it does not verify full functionality. Smoke [FAIL]: sh -c 'python -c "import pypdf; print(pypdf.__version__) Output: sh: 1: Syntax error: Unterminated quoted string
# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheel from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /build/dist /build/dist
RUN python -m pip install --no-cache-dir /build/dist/*.whl
# Smoke test to verify installation
CMD ["python", "-c", "import pypdf, sys; print('pypdf', getattr(pypdf, '__version__', 'unknown'))"]
Smoke [FAIL]: python -c 'import pypdf, sys; print("pypdf", getattr(pypdf, "__version__", "unknown"))
Output: sh: 1: Syntax error: Unterminated quoted string# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheel from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /build/dist /build/dist
RUN python -m pip install --no-cache-dir /build/dist/*.whl
# Prepare a simple smoke test script to verify installation without shell quoting issues
RUN printf 'import pypdf, sys\nprint("pypdf", getattr(pypdf, "__version__", "unknown"))\n' > /app/smoke.py
# Run smoke test script on container start
CMD ["python", "-c", "import pypdf, sys; print(\"pypdf\", getattr(pypdf, \"__version__\", \"unknown\"))"]
Smoke [FAIL]: python -c \"import pypdf; print('pypdf', getattr(pypdf, '__version__', 'unknown'))\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import pypdf; print('has PdfReader', hasattr(pypdf, 'PdfReader'))\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import pypdf; print(pypdf.__file__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheel from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /build/dist/pypdf-*.whl /tmp/pypdf-latest.whl
RUN python -m pip install --no-cache-dir /tmp/pypdf-latest.whl && rm -f /tmp/pypdf-latest.whl
# Smoke test to verify installation (exec form to avoid shell quoting issues)
CMD ["python", "-c", "import pypdf; print(pypdf.__version__)"]
Summary (under 1500 chars): - Exact error message and exit code - ERROR: pypdf-latest.whl is not a valid wheel filename. - Exit code: 1 (the RUN step failed) - Failing command/step - [runtime 4/4] RUN python -m pip install --no-cache-dir /tmp/pypdf-latest.whl && rm -f /tmp/pypdf-latest.whl - Missing packages or files mentioned - The wheel file being installed is /tmp/pypdf-latest.whl, copied from builder: COPY --from=builder /build/dist/pypdf-*.whl /tmp/pypdf-latest.whl - Builder produced pypdf-6.9.2-py3-none-any.whl (located at /build/dist/). The runtime error suggests a filename/format issue with pypdf-latest.whl rather than a missing file. - Version mismatch info - Base image: python:3.12-slim - Built wheel: pypdf-6.9.2-py3-none-any.whl - Pip notice: A new release of pip is available: 25.0.1 -> 26.0.1 (To update, run: pip install --upgrade pip) - Quick potential fix - Ensure the copied wheel has a valid filename that matches wheel conventions (e.g., use pypdf-6.9.2-py3-none-any.whl as the destination name) or adjust the COPY to preserve the exact built filename.
# Build from source and install the pypdf package
FROM python:3.12-slim as builder
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install build tools required to build a wheel from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libssl-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Ensure latest build tooling is available
RUN python -m pip install --upgrade pip setuptools wheel build flit_core
# Copy the project files (best-effort; the wheel will be built from source)
COPY pyproject.toml README.md LICENSE ./
COPY pypdf ./pypdf
COPY . .
# Build a wheel distribution from source
RUN python -m build --wheel
# Final minimal runtime image
FROM python:3.12-slim as runtime
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the built wheel from the builder stage and install it
COPY --from=builder /build/dist/pypdf-6.9.2-py3-none-any.whl /tmp/pypdf-6.9.2-py3-none-any.whl
RUN python -m pip install --no-cache-dir /tmp/pypdf-6.9.2-py3-none-any.whl && rm -f /tmp/pypdf-6.9.2-py3-none-any.whl
# Smoke test to verify installation (exec form to avoid shell quoting issues)
CMD ["python", "-c", "import pypdf; print(pypdf.__version__)"]