FROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
WORKDIR /workspace
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository
COPY . /workspace
WORKDIR /workspace
# Default to an interactive shell; users can run train.py/validate.py
CMD ["bash"]
# Exclude version control and build artifacts .git __pycache__/ *.pyc *.pyo *.pyd *.swp *.swo *.DS_Store *.egg-info/ build/ dist/ venv/ env/ ENV/ *.log logs/ coverage.xml *.ipynb_checkpoints/ Tests/
Concerns: Requires a requirements.txt present in the build context; if missing, the COPY and pip install steps will fail., PyTorch CPU wheel install can be time- and resource-intensive in constrained CI environments. Smoke [FAIL]: python -c 'import torch, torchvision; print(torch.__version__); print(torchvision.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import sys; print(sys.version.split()[0]) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'print(0) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH=/workspace
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl wget && \
rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
WORKDIR /workspace
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository
COPY . /workspace
WORKDIR /workspace
# Do not set a persistent CMD to avoid hard-coding entrypoint for smoke tests
Concerns: The image installs PyTorch CPU wheels which can be large; ensure this is required for the project., No explicit CMD/ENTRYPOINT; smoke tests rely on ad-hoc commands, which is intentional for smoke testing, but consider a lightweight entrypoint for production.
Smoke [FAIL]: python -c "import torch; a = torch.tensor([1.0, 2.0, 3.0], dtype=torch.float); print('torch_ok', a.sum().item())
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import torchvision; print('torchvision', torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import sys; print('python', sys.version.split()[0])
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH=/workspace
# Use bash for better compatibility with smoke tests
SHELL ["/bin/bash", "-lc"]
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl wget && \
rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
WORKDIR /workspace
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository
COPY . /workspace
WORKDIR /workspace
# Default to an interactive shell for smoke test friendliness
CMD ["bash"]
Concerns: No build of the application from source is performed; the Dockerfile primarily installs runtime dependencies (Python, PyTorch CPU wheels, and requirements) rather than building the project from source., Potential risk in build context: COPY requirements.txt is used before copying the rest of the repo; if requirements.txt is missing at build time, the image build will fail.
from setuptools import setup, find_packages
setup(
name="fastvit",
version="0.0.1",
packages=find_packages(),
description="FastViT - a fast hybrid vision transformer",
)
Concerns: No build step for the application from source; the image mainly installs dependencies (PyTorch, requirements) and copies the repo without compiling or building the project itself., PyTorch is pinned to an older CPU wheel (1.11.0+cpu); may be outdated and could cause compatibility issues with newer codebases., COPY . /workspace occurs after a separate COPY of requirements.txt, which is inefficient and could lead to mismatches between installed dependencies and the final repository contents.
FROM python:3.9-slim
# Improve reliability of shell quoting in smoke tests
SHELL ["/bin/bash", "-lc"]
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH=/workspace
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Prepare workspace and install dependencies from requirements.txt
WORKDIR /workspace
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository and install the package from source
COPY . ./
RUN pip install --no-cache-dir -e .
# Expose default command for interactive usage
CMD ["bash"]
Concerns: Minor duplication of ca-certificates in the apt-get install line; not harmful but could be cleaned up.
Smoke [FAIL]: python -c 'import torch, torchvision; print("torch:", torch.__version__); print("vision:", torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim-bullseye
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH=/workspace
WORKDIR /workspace
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl wget libjpeg-dev zlib1g-dev libpng-dev \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository and install the package from source
COPY . .
RUN pip install --no-cache-dir -e .
CMD ["bash"]
Concerns: The image installs a specific PyTorch CPU wheel which can be large and may increase build time; consider caching or pinning to a compatible range., The editable install (-e .) depends on a valid setup.py/pyproject; if the repository lacks proper packaging, the build could fail. No explicit verification of the installed package name is performed in smoke tests since the package name is unknown., No explicit tests verify the actual project package importability (due to unknown package name). The smoke tests focus on PyTorch import and environment presence.
Smoke [FAIL]: python -c "import torch; print('torch', torch.__version__); print('cuda', torch.cuda.is_available())
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [PASS]: test -f requirements.txt && echo requirements_present || echo requirements_missing
Smoke [FAIL]: python -c "import sys; print('workspace_path_in_python', '/workspace' in sys.path)
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Prepare workspace and install dependencies from requirements.txt
WORKDIR /workspace
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository and install the package from source
COPY . .
RUN pip install --no-cache-dir -e .
# Expose default command for interactive usage
CMD ["bash"]
Concerns: CMD uses bash which may not be installed on the slim image; consider using /bin/sh or install bash explicitly (e.g., apt-get install -y bash)., PyTorch version 1.11.0+cpu is quite old; verify compatibility with Python 3.9 and your codebase or consider updating to a newer CPU wheel if needed.
Smoke [FAIL]: python -c "import torch; t = torch.tensor([1.0, 2.0]); print('torch-ok', t.sum().item())
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import torchvision; print('torchvision-ok', torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import sys; print('python-version', sys.version)
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim-bullseye
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV LANG=C.UTF-8
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates wget \
libjpeg-dev zlib1g-dev libpng-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Python and PyTorch setup
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository and install the package from source
COPY . .
RUN pip install --no-cache-dir -e .
# Do not override CMD to allow external test harness to run commands directly
Smoke [FAIL]: python -c 'import torch; print("torch_version:"+torch.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import torchvision; print("torchvision_version:"+torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import torch; t=torch.tensor([1,2,3]); print(t.tolist())
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim-bullseye
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository
COPY . .
# Default to an interactive shell for ease of use
CMD ["bash"]
Concerns: No explicit build/install step for the repository's own package (no python setup.py install or pip install .). The image installs PyTorch and dependencies but does not build or install the framework from source., COPY . . is performed after dependency installation, which can lead to cache inefficiency and potential large image layers; also relies on presence of requirements.txt and repository files during build., CMD ["bash"] may fail if bash is not present in the slim base image; relying on an interactive shell is not suitable for automated smoke tests., Torch version is pinned to 1.11.0+cpu which is quite old and may have compatibility or security concerns with newer environments., No automated tests or smoke tests are defined in the Dockerfile; this creates a gap between building the image and verifying its usability.
FROM pytorch/pytorch:1.11.0-cpu
ENV PYTHONUNBUFFERED=1
WORKDIR /workspace
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates libjpeg-dev zlib1g-dev libpng-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip
RUN python -m pip install --upgrade pip
# Install Python dependencies first (to leverage layer caching)
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository and install the package from source
COPY . .
RUN pip install --no-cache-dir -e .
CMD ["bash"]
FROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
WORKDIR /workspace
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU) and torchvision
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the repository and install the package from source
COPY . .
RUN pip install --no-cache-dir -e .
CMD ["bash"]
Smoke [FAIL]: python -c "import torch; t = torch.tensor([1,2,3]); print(t.sum().item()) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c "import torchvision; print(torchvision.__version__) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.9-slim
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["/bin/bash"]
Smoke [FAIL]: python -c 'import torch; import torchvision as tv; print("torch OK", torch.__version__, "torchvision OK", tv.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import sys; print("Python OK", sys.version)
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["/bin/bash"]
Smoke [FAIL]: python -c 'import torch, torchvision; print("torch_ok:", torch.__version__, torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import sys; print("py_ok:", sys.version.split()[0])
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& ln -sf /bin/bash /bin/sh \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["/bin/bash"]
Smoke [FAIL]: python -c 'import torch; print("torch:", torch.__version__)
Output: sh: -c: line 1: unexpected EOF while looking for matching `''
Smoke [FAIL]: python -c 'import torchvision; print("torchvision:", torchvision.__version__)
Output: sh: -c: line 1: unexpected EOF while looking for matching `''
Smoke [FAIL]: python -c 'import sys; print("python:", sys.version.split()[0])
Output: sh: -c: line 1: unexpected EOF while looking for matching `''FROM python:3.9-slim
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["bash"]
Smoke [FAIL]: python -c 'import torch; print(torch.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import torchvision; print(torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import sys; print("python ok", sys.version.split()[0])
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& ln -sf /bin/bash /bin/sh \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["bash"]
Smoke [FAIL]: python -c 'import torch; print("torch:", torch.__version__)
Output: sh: -c: line 1: unexpected EOF while looking for matching `''
Smoke [FAIL]: python -c 'import torchvision; print("torchvision:", torchvision.__version__)
Output: sh: -c: line 1: unexpected EOF while looking for matching `''FROM pytorch/pytorch:1.13.1-cpu-py3.9
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["bash"]
FROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Add a minimal entrypoint to avoid shell-quoting issues in smoke tests
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# Default command (interactive shell when no cmd is provided)
CMD ["bash"]
#!/bin/bash
set -euo pipefail
case "$1" in
smoke)
python -c 'import torch, torchvision; print("OK-PT:", torch.__version__, torchvision.__version__)'
;;
*)
exec "$@"
;;
esac
Concerns: COPY requires requirements.txt to be present in build context; otherwise build fails., ENTRYPOINT relies on docker-entrypoint.sh; ensure the script is included in build context and handles CMD correctly. Smoke [FAIL]: python -c 'import torch; print(torch.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import torchvision; print(torchvision.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import sys; print(sys.version.split()[0]) Output: sh: 1: Syntax error: Unterminated quoted string
#!/bin/bash
set -euo pipefail
case "$1" in
smoke)
# Robust smoke test without relying on -c with quoted strings
python - <<'PY'
import torch, torchvision
print("OK-PT:", torch.__version__, torchvision.__version__)
PY
;;
*)
exec "$@"
;;
esac
Smoke [FAIL]: python -c 'import torch; print(torch.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import torchvision; print(torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'print("ok")
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /bin/bash /bin/sh
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["/bin/bash"]
Concerns: Build relies on a valid Python packaging configuration (setup.py or pyproject.toml) to install with pip install .; if missing, the build will fail., COPY . /workspace and subsequent pip install . assume the repository contains a Python package; ensure packaging metadata is present in the repo., The PyTorch CPU wheel makes the image large; consider further slimming or multi-stage builds if image size is a concern. Smoke [FAIL]: python -c 'import torch, torchvision; print(torch.__version__); print(torchvision.__version__) Output: sh: -c: line 1: unexpected EOF while looking for matching `'' Smoke [FAIL]: python -c 'import torch; x = torch.randn(2,3); print(x.shape) Output: sh: -c: line 1: unexpected EOF while looking for matching `'' Smoke [FAIL]: python -c 'import torch; print(torch.tensor([1.0,2.0,3.0]).sum().item()) Output: sh: -c: line 1: unexpected EOF while looking for matching `''
FROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["bash"]
Smoke [FAIL]: python -c "import torch; print('torch', torch.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "import torchvision; print('torchvision', torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string# Minimal dockerignore to speed up builds .git __pycache__/ *.pyc *.pyo *.pyd .Python build/ dist/ .eggs/ .eggs-info/ *.egg-info/ *.log *.tmp node_modules/ .DS_Store
FROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Create a python wrapper to robustly handle -c quoted strings in smoke tests
RUN bash -lc 'cat > /usr/local/bin/python <<"PYWRAP"\
#!/bin/bash\
if [ "$1" = "-c" ]; then\
shift; code="$*";\
exec /usr/bin/python3 -c "$code"\
else\
exec /usr/bin/python3 "$@"\
fi\
PYWRAP\
chmod +x /usr/local/bin/python'
# Copy source and build from source
WORKDIR /workspace
COPY . /workspace
# Install the project itself to ensure proper import paths
RUN pip install --no-cache-dir .
# Default command
CMD ["bash"]
- Exact error message and exit code
- ERROR: process "/bin/bash -lc bash -lc 'cat > /usr/local/bin/python <<\"PYWRAP\"if [ \"$1\" = \"-c\" ]; then shift; code=\"$*\"; exec /usr/bin/python3 -c \"$code\"else exec /usr/bin/python3 \"$@\"fiPYWRAPchmod +x /usr/local/bin/python'" did not complete successfully: exit code: 2
- Additional lines shown:
- 0.193 bash: line 1: warning: here-document at line 1 delimited by end-of-file (wanted `PYWRAPif')
- 0.193 bash: -c: line 1: syntax error near unexpected token `then'
- 0.193 bash: -c: `cat > /usr/local/bin/python <<"PYWRAP"if [ "$1" = "-c" ]; then shift; code="$*" ; exec /usr/bin/python3 -c "$code"else exec /usr/bin/python3 "$@"fiPYWRAPchmod +x /usr/local/bin/python'
- Failing command/step
- [ 7/10] RUN bash -lc 'cat > /usr/local/bin/python <<"PYWRAP"if [ "$1" = "-c" ]; then shift; code="$*" ; exec /usr/bin/python3 -c "$code"else exec /usr/bin/python3 "$@"fiPYWRAPchmod +x /usr/local/bin/python'
- Missing packages or files mentioned
- None explicitly mentioned as missing; error is due to a syntax/error in a here-document used to create a Python wrapper script.
- Version mismatch information
- Base image: python:3.9-slim
- Torch versions pinned earlier: torch==1.13.1+cpu, torchvision==0.14.1+cpu (CPU wheels) referenced in prior step
- No explicit version mismatch reported; failure is due to the shell here-document syntax in the RUN step.FROM python:3.9-slim
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libjpeg-dev \
libpng-dev \
git \
wget \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU only) and torchvision
RUN pip install --no-cache-dir --upgrade git+https://github.com/pytorch/pytorch
RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
# Install Python dependencies required by the project
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Copy source
WORKDIR /workspace
COPY . /workspace
# Default command
CMD ["bash"]
Failing step - [3/8] RUN pip install --no-cache-dir --upgrade git+https://github.com/pytorch/pytorch Exact error message and exit code - Getting requirements to build wheel did not run successfully. - exit code: 255 - You are using Python 3.9.25. Python >=3.10.0 is required. - Docker build failure summary: - process "/bin/bash -lc pip install --no-cache-dir --upgrade git+https://github.com/pytorch/pytorch" did not complete successfully: exit code: 1 Missing packages or files mentioned - Version mismatch: PyTorch build requires Python >= 3.10.0, but the image is using Python 3.9.x (Python 3.9.25), causing the failure. Version mismatch information - Base image uses python:3.9-slim (Python 3.9.x) - PyTorch build from source via GitHub requires Python >= 3.10.0 - Therefore, the PyTorch installation step cannot proceed due to Python version incompatibility
FROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install PyTorch CPU wheels and Python dependencies
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python3", "train.py", "--help"]
#!/usr/bin/env bash
set -euo pipefail
# Minimal smoke test to verify Python imports and environment
echo "[entrypoint] Running minimal smoke test..."
python - <<'PY'
import torch
print("Torch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
PY
# Execute the provided command (CMD) or default to nothing
exec "$@"
# Ignore common VCS folders and environment/venv .git venv/ .env .envs/ *.pyc __pycache__/ .DS_Store # Node and build artefacts node_modules/ dist/ build/ *.egg-info/ # Pytest cache .pytest_cache/
Smoke [FAIL]: python3 -c "import torch; print(torch.__version__); print('OK')
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [PASS]: python3 train.py --help
Smoke [FAIL]: python3 -c "import torchvision; print(torchvision.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string#!/usr/bin/env bash set -euo pipefail if [[ "$1" == "-c" ]]; then CODE="$2" /usr/bin/python3 -c "$CODE" else exec /usr/bin/python3 "$@" fi
#!/usr/bin/env bash
set -euo pipefail
# Minimal smoke test to verify Python imports and environment
echo "[entrypoint] Running minimal smoke test..."
python - <<'PY'
import torch
print("Torch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
PY
# Execute the provided command (CMD) or default to nothing
exec "$@"
FROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install PyTorch CPU wheels and Python dependencies
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Add a Python3 wrapper to robustly handle -c smoke tests in verify builds
COPY python3 /usr/local/bin/python3
RUN chmod +x /usr/local/bin/python3
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python3", "train.py", "--help"]
#!/usr/bin/env bash set -euo pipefail # Simple wrapper to avoid shell quoting issues when running python -c strings /usr/bin/python3 "$@"
Concerns: Requires docker-entrypoint.sh and the Python3 wrapper script to exist in the repository; ensure these files are present in the build context, PyTorch installation in a slim Python image can be heavy; consider image size and build time implications
Smoke [FAIL]: python3 -c \"import torch; print('torch', torch.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python3 train.py --help
Output: /usr/local/bin/python3: line 4: /usr/bin/python3: No such file or directory
Smoke [FAIL]: python3 -V
Output: /usr/local/bin/python3: line 4: /usr/bin/python3: No such file or directoryFROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies and PyTorch CPU wheels
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Build timed out after 600s
Concerns: Possible oversized image due to build-essential and git; consider slimming or multi-stage builds., smoke-test environment overrides entrypoint; ensure docker-entrypoint.sh is robust when CMD is overridden., COPY . /app may copy large or sensitive files; ensure a proper .dockerignore. Smoke [PASS]: python -V Smoke [FAIL]: python -c "import torch; print(torch.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: ls -la /app
FROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies and PyTorch CPU wheels
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Concerns: The Dockerfile references docker-entrypoint.sh but that script is not shown in the snippet; ensure the file exists in the build context and is executable., requirements.txt is copied and used for installation; if the file is missing in the build context, the build will fail. Ensure requirements.txt exists., If train.py requires a dataset or specific environment, running training by default could fail; the --help option helps, but consider validating a minimal run that does not depend on external data. Smoke [FAIL]: python -c 'import torch; print(torch.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import torchvision; print(torchvision.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: python train.py --help
FROM pytorch/pytorch:2.2.0-cpu
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
FROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies including PyTorch CPU wheels
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Concerns: Image size may be large due to PyTorch CPU wheels; consider a slimmer base or selective dependencies if image size is a concern., CMD defaults to training help; ensure train.py --help is a valid quick smoke check and that docker-entrypoint.sh handles arguments correctly when used in normal runs., COPY requirements.txt must be present in the build context; if missing, docker build will fail.
Smoke [FAIL]: python -c \"import torch; print('torch', torch.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import sys; print('python', sys.version.split()[0])\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [PASS]: python train.py --helpFROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies including PyTorch CPU wheels
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Concerns: Relies on docker-entrypoint.sh existing and being compatible with the ENTRYPOINT instruction, CMD runs train.py --help by default; ensure train.py exists and handles --help as expected Smoke [PASS]: python train.py --help Smoke [FAIL]: python -c 'import torch; print(torch.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import sys; print(sys.version) Output: sh: 1: Syntax error: Unterminated quoted string
FROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies and PyTorch CPU wheels
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Smoke [FAIL]: python -c \"import torch, torchvision; print('torch-ok', torch.__version__, torchvision.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import torchaudio; print('torchaudio-ok', torchaudio.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [PASS]: python train.py --helpFROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates bash \
&& ln -sf /bin/bash /bin/sh \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies and PyTorch CPU wheels
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Build timed out after 600s
FROM python:3.9-slim
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for caching
COPY requirements.txt /app/requirements.txt
# Install Python dependencies and PyTorch CPU wheels
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Copy the rest of the repository
COPY . /app
# Setup entrypoint for smoke test
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["python", "train.py", "--help"]
Smoke [PASS]: python train.py --help Smoke [FAIL]: python -c "import torch; print(torch.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c "import sys; print(sys.version.split()[0]) Output: sh: 1: Syntax error: Unterminated quoted string