ARG PYTHON_VERSION=3.9
FROM python:${PYTHON_VERSION}
WORKDIR /pkb
SHELL ["/bin/bash", "-c"]
# Install system dependencies needed for building Python wheels
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /pkb/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /pkb/
RUN pip install --no-cache-dir -r requirements-testing.txt
# Run tests in isolation
CMD set -Eeuo pipefail; for test in $(find tests/ | grep "test.py"); do echo ; echo "Running $test ..."; python -m unittest $test -v ; done
FROM python:3.9-slim
WORKDIR /pkb
SHELL ["/bin/bash", "-c"]
# Install system dependencies needed for building Python wheels
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /pkb/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /pkb/
RUN pip install --no-cache-dir -r requirements-testing.txt
# Run tests in isolation
CMD set -Eeuo pipefail; for test in $(find tests/ | grep "test.py"); do echo ; echo "Running $test ..."; python -m unittest $test -v ; done
__pycache__/ *.pyc *.pyo *.pyd *.egg-info/ build/ dist/ downloads/ *.egg *.egg-info .eggs *.log *.tmp .vscode/ .env venv/ */__pycache__/ node_modules/ .git/
Concerns: CMD uses Bash-specific options (set -Eeuo pipefail) but the default CMD runs under /bin/sh, which will likely cause the container to fail to start due to an invalid set command., The Dockerfile does not install the CLI package entrypoint itself (no 'pip install -e .' or similar). This means the actual CLI binary/entrypoint may not be available in PATH, so the container may not exercise the CLI even if tests run., Test invocation in CMD is brittle: it relies on finding test.py files with find/grep and passes file paths to python -m unittest. This can break with spaces in paths or changes in test layout. A more robust approach is to use unittest discover or a dedicated test script.
ARG PYTHON_VERSION=3.9
FROM python:${PYTHON_VERSION}-slim
WORKDIR /pkb
SHELL ["/bin/bash", "-lc"]
# Install system dependencies needed for building Python wheels
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /pkb/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /pkb/
RUN pip install --no-cache-dir -r requirements-testing.txt
# Optionally install the package in editable mode if setup.py exists
RUN if [ -f setup.py ]; then pip install --no-cache-dir -e .; else echo "No setup.py found, skipping editable install"; fi
# Run tests in isolation
CMD ["bash","-lc","set -euo pipefail; python -m unittest discover -v tests"]
FROM python:3.9-slim
WORKDIR /pkb
SHELL ["/bin/bash", "-lc"]
# Install system dependencies needed for building Python wheels
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /pkb/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /pkb/
RUN pip install --no-cache-dir -r requirements-testing.txt
# Optionally install the package in editable mode if setup.py exists
RUN if [ -f setup.py ]; then pip install --no-cache-dir -e .; else echo "No setup.py found, skipping editable install"; fi
# Run tests in isolation
CMD ["bash","-lc","set -euo pipefail; python -m unittest discover -v tests"]
Concerns: Potential missing python3-dev could block building some Python package wheels that require Python headers; not necessarily fatal for all repos, but a possible pitfall.
Smoke [PASS]: python -V
Smoke [FAIL]: python -c \"import sys; print('ok', sys.version.split()[0])\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [PASS]: python -m unittest discover -v testsFROM python:3.9-slim
WORKDIR /pkb
SHELL ["/bin/bash", "-lc"]
# Install system dependencies needed for building Python wheels
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /pkb/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /pkb/
RUN pip install --no-cache-dir -r requirements-testing.txt
# Optionally install the package in editable mode if setup.py exists
RUN if [ -f setup.py ]; then pip install --no-cache-dir -e .; else echo "No setup.py found, skipping editable install"; fi
# Run tests in isolation
CMD ["bash","-lc","set -euo pipefail; python -m unittest discover -v tests"]
FROM python:3.9-slim
WORKDIR /pkb
SHELL ["/bin/bash", "-lc"]
# Install system dependencies needed for building Python wheels
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential python3-dev libffi-dev libssl-dev ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /pkb/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /pkb/
RUN pip install --no-cache-dir -r requirements-testing.txt
# Optionally install the package in editable mode if setup.py exists
RUN if [ -f setup.py ]; then pip install --no-cache-dir -e .; else echo "No setup.py found, skipping editable install"; fi
# Run tests in isolation
CMD ["bash", "-lc", "python -m unittest discover -v tests"]
Concerns: If the project uses pyproject.toml instead of setup.py, the editable install step will be skipped; tests may rely on an installed package., No explicit CLI binary smoke test is included; the container's smoke test relies on running the test suite. Smoke [PASS]: python -m unittest discover -v tests