FROM python:3.11-slim
LABEL maintainer="chaostoolkit <contact@chaostoolkit.org>"
# Create non-root user
RUN groupadd -g 1001 svc && useradd -m -u 1001 -g svc svc
WORKDIR /home/svc
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
ca-certificates \
libffi-dev \
gcc && \
rm -rf /var/lib/apt/lists/*
# Copy source code
COPY --chown=svc:svc . /home/svc/
# Create a Python virtual environment and install the project from source
RUN python -m venv /home/svc/.venv
# Use the venv for all following steps
ENV PATH="/home/svc/.venv/bin:${PATH}"
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir pdm
# Install this project from source into the venv
RUN pip install --no-cache-dir -e .
# Run as non-root user
USER 1001
ENTRYPOINT ["chaos"]
CMD ["--help"]
# Ignore VCS and build artifacts .git __pycache__/ build/ dist/ *.egg-info/ # Node modules and Python caches node_modules/ __pypackages__/ *.pytest_cache/ *.ruff_cache/ # Virtual environments venv/ *.venv/ # PyCharm .idea/ # OS files .DS_Store
Failing step - [9/9] RUN pip install --no-cache-dir -e . Exact error message and exit code - pdm.backend.exceptions.ConfigError: Cannot find the version from SCM or SCM isn't detected. You can still specify the version via environment variable `PDM_BUILD_SCM_VERSION`, or specify `fallback_version` config. - metadata-generation-failed - Encountered error while generating package metadata. - error: metadata-generation-failed - The build ultimately fails with: ERROR: failed to build: failed to solve: process "/bin/sh -c pip install --no-cache-dir -e ." did not complete successfully: exit code: 1 Missing packages or files mentioned - None explicitly cited. The error is due to SCM-based version detection failing during editable install, not a missing system package or file. Version mismatch / guidance notes - The issue is a packaging/version-detection problem in the editable install step using PDM. - Suggested remediation in the error output: - Set environment variable PDM_BUILD_SCM_VERSION, or - Configure a fallback_version in PDM.
FROM python:3.11-slim
LABEL maintainer="chaostoolkit <contact@chaostoolkit.org>"
ARG ctkversion
# Create non-root user
RUN groupadd -g 1001 svc && useradd -m -u 1001 -g svc svc
WORKDIR /home/svc
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
libffi-dev \
gcc \
build-essential && \
rm -rf /var/lib/apt/lists/*
# Copy build configuration first to utilize Docker cache
COPY pyproject.toml pdm.lock /home/svc/
# Install PDM and prepare the virtual environment using PDM
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
python -m pip install --no-cache-dir pdm
# Create and configure the project virtual environment via PDM
RUN pdm venv create python3.11
RUN pdm use .venv
# Install project dependencies from lock file in production mode
RUN pdm update --no-editable --prod --frozen-lockfile
# Copy the remaining source code
COPY --chown=svc:svc . /home/svc/
# Ensure the venv is used in PATH
ENV PATH="/home/svc/.venv/bin:${PATH}"
# Run as non-root user
USER 1001
ENTRYPOINT ["chaos"]
CMD ["--help"]
Summary of Docker build error
- Failing step (command/step):
- [ 9/10] RUN pdm update --no-editable --prod --frozen-lockfile
- Exact error message and exit code:
- [BuildError]: Build backend raised error: Showing the last 10 lines of the build output:
...
pdm.backend.exceptions.ValidationError: project.readme.file: Readme file not found ('README.md')
- WARNING: Add '-v' to see the detailed traceback
- ERROR: process "/bin/sh -c pdm update --no-editable --prod --frozen-lockfile" did not complete successfully: exit code: 1
- Failing/missing file:
- README.md is missing (Readme file not found)
- Version/compatibility information observed
- Base image uses Python 3.11: FROM docker.io/library/python:3.11-slim (Debian trixie)
- PDm/pip-related warnings during resolution indicate Python version compatibility adjustments, e.g.:
- Skipping click/* versions that require Python>=3.10 due to lock targets (Python>=3.8)
- Build environment shows DEPRECATED: cross_platform strategy is deprecated in favor of lock targets
- Several package resolution messages noting Python 3.11 compatibility versus lock targets (>=3.8)
Notes
- All prior steps before this RUN pdm update completed, but the build fails due to the missing README.md referenced by the PDm lock/update process. Addressing the repository to include README.md or adjusting the PDm configuration to not require it should allow the build to proceed.FROM python:3.11-slim
LABEL maintainer="chaostoolkit <contact@chaostoolkit.org>"
# Create non-root user
RUN groupadd -g 1001 svc && useradd -m -u 1001 -g svc svc
WORKDIR /home/svc
# Copy build configuration first to utilize Docker cache
COPY pyproject.toml pdm.lock /home/svc/
# Install build dependencies and Python tooling
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
libffi-dev \
gcc \
build-essential && \
rm -rf /var/lib/apt/lists/* && \
python -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
python -m pip install --no-cache-dir pdm
# Create and configure the project virtual environment via PDM
RUN pdm venv create python3.11
RUN pdm use .venv
# Copy the rest of the source code (including README.md which is required by PDm)
COPY --chown=svc:svc . /home/svc/
# Ensure the venv is used in PATH
ENV PATH="/home/svc/.venv/bin:${PATH}"
# Install project dependencies from lock file in production mode
RUN pdm update --no-editable --prod --frozen-lockfile
# Remove build dependencies to shrink the final image
RUN apt-get purge -y --auto-remove gcc build-essential && \
rm -rf /var/lib/apt/lists/*
# Run as non-root user
USER 1001
ENTRYPOINT ["chaos"]
CMD ["--help"]
- Failing step (command): RUN pdm update --no-editable --prod --frozen-lockfile (Dockerfile step 9/10) - Exact error message and exit code: - exit code: 1 - pdm.backend.exceptions.ConfigError: Cannot find the version from SCM or SCM isn't detected. - You can still specify the version via environment variable `PDM_BUILD_SCM_VERSION`, or specify `fallback_version` config. - WARNING: Add '-v' to see the detailed traceback - Summary of failure: - The PDm build cannot determine the project version from SCM. As a result, pdm update fails with a ConfigError and the build stops with exit code 1. - Missing files/packages referenced: - Root cause implies SCM version not detected; to fix, provide a SCM version via environment variable PDM_BUILD_SCM_VERSION or configure a fallback_version in PDm. - Version mismatch / notes: - Base image uses Python 3.11-slim, while the lockfile targets Python >= 3.8; there are warnings about package versions (e.g., click) requiring Python >= 3.10, leading PDm to skip certain candidates. These are warnings and not the direct cause, but indicate a Python-version mismatch between the environment and some package constraints.
FROM python:3.11-slim
LABEL maintainer="chaostoolkit <contact@chaostoolkit.org>"
ARG PDM_BUILD_SCM_VERSION=0.0.0
# Create non-root user
RUN groupadd -g 1001 svc && useradd -m -u 1001 -g svc svc
WORKDIR /home/svc
# Copy build configuration first to utilize Docker cache
COPY pyproject.toml pdm.lock /home/svc/
# Install build dependencies and Python tooling
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
libffi-dev \
gcc \
build-essential && \
rm -rf /var/lib/apt/lists/* && \
python -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
python -m pip install --no-cache-dir pdm
# Create and configure the project virtual environment via PDM
RUN pdm config build-system.requirements-python 3.11 || true
RUN pdm venv create python3.11
RUN pdm use .venv
# Expose PDM SCM version to the build process
ENV PDM_BUILD_SCM_VERSION=${PDM_BUILD_SCM_VERSION}
# Copy the rest of the source code (including README.md)
COPY --chown=svc:svc . /home/svc/
# Ensure the venv is used in PATH
ENV PATH="/home/svc/.venv/bin:${PATH}"
# Install project dependencies from lock file in production mode
RUN pdm update --no-editable --prod --frozen-lockfile
# Remove build dependencies to shrink the final image
RUN apt-get purge -y --auto-remove gcc build-essential && \
rm -rf /var/lib/apt/lists/*
# Run as non-root user
USER 1001
ENTRYPOINT ["chaos"]
CMD ["--help"]
Concerns: No explicit CLI functionality smoke test beyond help/version; consider adding more tests for a basic command execution., If any Python package requires build-time dependencies not present in the final image, verify they are properly handled or consider alternative packaging. Smoke [PASS]: command -v chaos Smoke [PASS]: chaos --help