# Built for Biopython: build from source in a lightweight Python 3.10 image
FROM python:3.10-slim-bullseye
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install essential build dependencies for compiling C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set workdir to the repository root where setup.py lives
WORKDIR /opt/biopython
# Copy the repository into the image
COPY . /opt/biopython
# Install Python tooling and build dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install numpy
# Build and install Biopython from source
RUN python -m pip install .
# Quick verification after install
RUN python -c "import Bio; print('Biopython version:', Bio.__version__)"
# Default command: print version as a quick runtime check
CMD ["python", "-c", "import Bio; print('Biopython version (runtime):', Bio.__version__)" ]
# Ignore git and build artifacts .git/ **/__pycache__/ **/*.pyc build/ dist/ *.eggs/ *.egg-info/ *.tar.gz *.whl *.egg
Concerns: COPY . /opt/biopython assumes the build context contains the Biopython source; in CI ensure the repository files are present when running docker build., The image installs many build dependencies and builds from source which can produce a relatively large image; consider a multi-stage build or slimming steps if size is a concern., No non-root user is created; runtime runs as root. For better security, consider adding a non-root user for container execution.
Smoke [FAIL]: python -c 'import Bio; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import Bio; print("version:", Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string# Built for Biopython: build from source in a lightweight Python 3.10 image
FROM python:3.10-slim-bullseye
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install essential build dependencies for compiling C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set workdir to the repository root where setup.py lives
WORKDIR /opt/biopython
# Copy the repository into the image
COPY . /opt/biopython
# Install Python tooling and build dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install numpy
# Build and install Biopython from source
RUN python -m pip install .
# Quick verification after install
RUN python -c "import Bio; print('Biopython version:', Bio.__version__)"
# Default command: print version as a quick runtime check
CMD ["python3", "-V"]
Concerns: The image builds Biopython from source in a slim Python base, which may result in a relatively large final image due to build dependencies; consider using a multi-stage build and/or cleaning up build tools after installation to reduce image size.
Smoke [FAIL]: python -c 'import Bio; print("Biopython version:", Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string# Built for Biopython: build from source in a lightweight Python 3.10 image
FROM python:3.10-slim-bullseye
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install essential build dependencies for compiling C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set workdir to the repository root where setup.py lives
WORKDIR /opt/biopython
# Copy the repository into the image
COPY . /opt/biopython
# Install Python tooling and build dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install numpy
# Build and install Biopython from source
RUN python -m pip install .
# Quick verification after install
RUN bash -lc 'python - << "PY"\nimport Bio\nprint("Biopython version:", Bio.__version__)\nPY'
# Default command: print version as a quick runtime check
CMD ["python3", "-V"]
Summary of Docker build error (concise)
- Failing step
- [7/7] RUN bash -lc 'python - << "PY"\nimport Bio\nprint("Biopython version:", Bio.__version__)\nPY'
- Exact error messages and exit code
- "bash: line 1: warning: here-document at line 1 delimited by end-of-file (wanted `PYnimport')"
- "bash: -c: line 1: syntax error near unexpected token `('"
- "bash: -c: line 1: `python - << \"PY\"\\nimport Bio\\nprint(\"Biopython version:\", Bio.__version__)\\nPY'"
- "ERROR: failed to build: failed to solve: process \"/bin/bash -lc bash -lc 'python - << \\\"PY\\\"\\\\nimport Bio\\\\nprint(\\\"Biopython version:\\\", Bio.__version__)\\\\nPY'\" did not complete successfully: exit code: 2"
- Missing packages or files mentioned
- None reported. Biopython was installed earlier in the build; the failure is due to a malformed here-document in the final RUN command, not a missing package/file.
- Version mismatch info
- Base image: python:3.10-slim-bullseye
- numpy: 2.2.6 (installed via pip)
- Biopython: 1.87.dev0 (built and installed)
- No explicit version mismatch reported; error stems from incorrect heredoc syntax in the RUN step.# Built for Biopython: build from source in a lightweight Python 3.10 image
FROM python:3.10-slim-bullseye
# Use bash for simple inline commands
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install essential build dependencies for compiling C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set workdir to the repository root where setup.py lives
WORKDIR /opt/biopython
# Copy the repository into the image
COPY . /opt/biopython
# Install Python tooling and build dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install numpy
# Build and install Biopython from source
RUN python -m pip install .
# Quick verification after install
RUN python -c "import Bio; print('Biopython version:', Bio.__version__)"
# Default command: show the Python version (quick runtime check)
CMD ["python", "-V"]
Concerns: Image may be large due to full build toolchain; consider a multi-stage build to separate build from runtime and reduce final image size., No explicit Biopython version pin; building from local context could lead to non-reproducible images unless a specific tag/commit is used.
Smoke [FAIL]: python -c "import Bio; print('Biopython version:', Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "from Bio.Seq import Seq; s = Seq('ATGC'); print(str(s.reverse_complement()))
Output: sh: 1: Syntax error: Unterminated quoted string# Built for Biopython: build from source in a lightweight Python 3.10 image
FROM python:3.10-slim-bullseye
# Use bash for simple inline commands
SHELL ["/bin/bash", "-lc"]
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install essential build dependencies for compiling C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set workdir to the repository root where setup.py lives
WORKDIR /opt/biopython
# Copy the repository into the image
COPY . /opt/biopython
# Install Python tooling and build dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install numpy
# Build and install Biopython from source
RUN python -m pip install .
# Default command: quick runtime check of Python version
CMD ["python", "-V"]
Smoke [FAIL]: python -c 'import Bio; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'from Bio.Seq import Seq; s = Seq("ACGT"); print(s.complement())
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'import Bio; print(getattr(Bio, "__version__", "unknown"))
Output: sh: 1: Syntax error: Unterminated quoted string# Multi-stage Dockerfile to build Biopython from source and install into a slim runtime
# Builder stage: compile and install Biopython from source
FROM python:3.10-slim-bullseye AS builder
# Install build dependencies for compiling C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Copy only the repository code for building
COPY . /src
# Install Python tooling and build dependencies
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install numpy \
&& python -m pip install .
# Runtime stage: copy installed Biopython from builder
FROM python:3.10-slim-bullseye
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
# Copy site-packages from builder so Bio is available without rebuilding
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
# Optional: verify import at build time (no execution here)
# Default command: a quick runtime check of Python version
CMD ["python", "-V"]
Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import Bio.SeqIO as sio; print(sio.__name__) Output: sh: 1: Syntax error: Unterminated quoted string
# Simple one-stage build: build Biopython from source on Python 3.10 slim
FROM python:3.10-slim-bullseye
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies for C extensions
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libncurses5-dev \
libreadline-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy source
COPY . /opt/biopython
# Build and install from source
RUN python -m pip install --upgrade pip setuptools wheel numpy \
&& python -m pip install .
# Quick runtime check (will print version when run)
CMD ["python", "-V"]
Smoke [FAIL]: python -c 'import Bio; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'from Bio.Seq import Seq; print(Seq("ACG").complement())
Output: sh: 1: Syntax error: Unterminated quoted string# Multi-stage build for Biopython from source
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy minimal sources needed for building Biopython from source
COPY setup.py /opt/biopython/setup.py
COPY Bio /opt/biopython/Bio
# Ensure build tooling is up-to-date and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
# Ignore VCS and common bulky dirs .git __pycache__/ .DS_Store build/ dist/ *.egg-info/ # Node modules and other typical temp folders node_modules/ *.log # Biopython's tests/docs; keep only what's needed in the image Tests/ Doc/ Docs/ Bio/Tests/
Concerns: CMD starts an interactive Python shell; in non-interactive container runs it may exit immediately. Consider using a non-interactive command to verify the installation (e.g., run a quick import test)., The runtime image installs only ca-certificates; Biopython may rely on optional system libraries for some features. This is usually fine, but worth validating if you rely on those features. Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__) Output: sh: 1: Syntax error: Unterminated quoted string
# Multi-stage build for Biopython from source
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy the entire repository to build from source
COPY . /opt/biopython/
# Ensure build tooling is up-to-date and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Quick smoke test using a robust quoting style
RUN python -c "import Bio; print(Bio.__version__)"
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
Concerns: Runtime image relies on libraries copied from the builder stage; ensure required system libraries (e.g., zlib, libbz2) are present in the runtime base image to avoid import/run-time errors., The final CMD starts an interactive Python shell by default; for a library image, consider using a non-interactive entrypoint or command.
Smoke [FAIL]: python3 -c 'import Bio; print(Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python3 -c 'from Bio.Seq import Seq; s = Seq("ACGT"); print(s.reverse_complement())
Output: sh: 1: Syntax error: Unterminated quoted string# Multi-stage build for Biopython from source
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy the entire repository to build from source
COPY . /opt/biopython/
# Ensure build tooling is up-to-date and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Quick smoke test using robust quoting style
RUN python -c "import Bio; print(Bio.__version__)"
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates zlib1g libbz2-1.0 liblzma5 libncurses6 libreadline8 && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
Concerns: Builder stage may require development headers (e.g., libbz2-dev, zlib1g-dev, liblzma-dev) to compile Biopython from source; absence could cause build failure., Runtime image includes a minimal set of system libraries; depending on which Biopython modules are used, additional runtime dependencies (e.g., OpenSSL, XML libraries) might be needed for full functionality.
Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'from Bio.Seq import Seq; s = Seq("ACGT"); print(s)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'from Bio import Entrez; print(Entrez.__name__)
Output: sh: 1: Syntax error: Unterminated quoted string# Multi-stage build for Biopython from source
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
gcc \
g++ \
python3-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libreadline-dev \
libncurses5-dev \
libsqlite3-dev \
libssl-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy the entire repository to build from source
COPY . /opt/biopython/
# Ensure build tooling is up-to-date and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Quick smoke test using robust quoting style
RUN python -c "import Bio; print(Bio.__version__)"
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates libz3-1 && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
- Exact error message and exit code - ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends ca-certificates libz3-1 && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100 - E: Unable to locate package libz3-1 - Failing command/step - [stage-1 2/4] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libz3-1 && rm -rf /var/lib/apt/lists/* - Missing packages or files mentioned - libz3-1: Unable to locate package libz3-1 - Version mismatch / repository context - The base image is python:3.10-slim-bullseye (Debian Bullseye). libz3-1 is not available in the Bullseye apt sources, indicating a package/repo version mismatch or an incorrect package name for this Debian release. - Additional note - Warning observed: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 3)
# Biopython: build from source using multi-stage build
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies required to compile Biopython
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
gcc \
g++ \
python3-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libreadline-dev \
libncurses5-dev \
libsqlite3-dev \
libssl-dev \
libffi-dev \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy the full repository to build from source
COPY . /opt/biopython/
# Upgrade packaging tools and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Quick smoke test using robust quoting style
RUN python -c "import Bio; print(Bio.__version__)"
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "from Bio.Seq import Seq; print(Seq('ACG').reverse_complement())
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "from Bio.Seq import Seq; print(Seq('atgc').upper())
Output: sh: 1: Syntax error: Unterminated quoted string# Biopython: build from source using multi-stage build
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies required to compile Biopython
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
gcc \
g++ \
python3-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libreadline-dev \
libncurses5-dev \
libsqlite3-dev \
libssl-dev \
libffi-dev \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy the full repository to build from source
COPY . /opt/biopython/
# Upgrade packaging tools and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
Concerns: The final CMD starts an interactive Python shell (CMD ["python3"]). This is unusual for a library image; consider switching to a non-interactive default command or removing a default CMD., COPY . /opt/biopython/ copies the entire build context into the image. Consider adding a .dockerignore to exclude tests, local artifacts, and other non-essential files to keep the image lean.
Smoke [FAIL]: python3 -c 'import Bio; print("ok")
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python3 -c 'from Bio import Seq; print("Seq loaded")
Output: sh: 1: Syntax error: Unterminated quoted string# Biopython: build from source using multi-stage build
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies required to compile Biopython
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
gcc \
g++ \
python3-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libreadline-dev \
libncurses5-dev \
libsqlite3-dev \
libssl-dev \
libffi-dev \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy minimal repository contents needed to build
COPY setup.py /opt/biopython/setup.py
COPY Bio /opt/biopython/Bio
# Upgrade packaging tools and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Quick smoke test using robust quoting style
RUN python -c "import Bio; print(Bio.__version__)"
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
Concerns: Copying only setup.py and the Bio package directory may omit other files that could be needed for a full build in some environments (e.g., MANIFEST.in, additional data files). If the build ever relies on files outside these paths, the build could fail., The final image copies the entire /usr/local from the builder, which may be larger than necessary. Consider minimizing the runtime image by selectively copying only the installed package directories.
Smoke [FAIL]: python -c "import Bio; print(Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "from Bio.Seq import Seq; s = Seq('ACGT'); print(len(s))
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c "from Bio.Seq import Seq; s = Seq('ACGT'); print(str(s))
Output: sh: 1: Syntax error: Unterminated quoted string# Biopython: build from source using multi-stage build
# Stage 1: builder
FROM python:3.10-slim-bullseye as builder
ENV PYTHONUNBUFFERED=1
# Install build dependencies required to compile Biopython
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
gcc \
g++ \
python3-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libreadline-dev \
libncurses5-dev \
libsqlite3-dev \
libssl-dev \
libffi-dev \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/biopython
# Copy the minimal repository contents needed to build
COPY setup.py /opt/biopython/setup.py
COPY Bio /opt/biopython/Bio
# Upgrade packaging tools and build Biopython
RUN python -m pip install --upgrade pip setuptools wheel
RUN pip install .
# Quick smoke test using robust quoting style
RUN python -c "import Bio; print(Bio.__version__)"
# Stage 2: runtime
FROM python:3.10-slim-bullseye
ENV PYTHONUNBUFFERED=1
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
WORKDIR /opt/biopython
CMD ["python3"]
Smoke [FAIL]: python3 -c "import Bio; print(Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python3 -c "from Bio.Seq import Seq; print(Seq('acg').upper())
Output: sh: 1: Syntax error: Unterminated quoted string# Multistage Docker build: build from source, then install wheel in runtime image
FROM python:3.10-slim-bullseye as builder
WORKDIR /src
# Copy the full repository (Biopython source)
COPY . /src/
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential python3-dev zlib1g-dev libbz2-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip tooling
RUN python -m pip install --upgrade pip setuptools wheel
# Build a wheel for Biopython to install in a lean runtime image
RUN python -m pip wheel . -w /wheelhouse
FROM python:3.10-slim-bullseye as runtime
# Runtime libraries required by compiled extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g libbz2-1.0 liblzma5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /wheelhouse /wheelhouse
# Install Biopython from the wheel
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl
# Smoke test: verify Biopython can be imported and has a version
CMD ["python3", "-c", "import Bio; print(Bio.__version__)" ]
Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__) Output: sh: 1: Syntax error: Unterminated quoted string
# Multistage Docker build: build from source, then install wheel in runtime image
FROM python:3.10-slim-bullseye as builder
WORKDIR /src
# Copy the full repository (Biopython source)
COPY . /src/
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential python3-dev zlib1g-dev libbz2-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip tooling
RUN python -m pip install --upgrade pip setuptools wheel
# Build a wheel for Biopython to install in a lean runtime image
RUN python -m pip wheel . -w /wheelhouse
FROM python:3.10-slim-bullseye as runtime
# Runtime libraries required by compiled extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g libbz2-1.0 liblzma5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /wheelhouse /wheelhouse
# Install Biopython from the wheel
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl
# Smoke test: verify Biopython can be imported and has a version
RUN printf 'import Bio; print(Bio.__version__)' > /smoke_bio.py
CMD ["python3", "/smoke_bio.py"]
Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__) Output: sh: 1: Syntax error: Unterminated quoted string Smoke [FAIL]: python -c 'import Bio; print(Bio.__file__) Output: sh: 1: Syntax error: Unterminated quoted string
# Multistage Docker build: build from source, then install wheel in runtime image
FROM python:3.10-slim-bullseye as builder
WORKDIR /src
# Copy the full repository (Biopython source)
COPY . /src/
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential python3-dev zlib1g-dev libbz2-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip tooling
RUN python -m pip install --upgrade pip setuptools wheel
# Build a wheel for Biopython to install in a lean runtime image
RUN python -m pip wheel . -w /wheelhouse
# Smoke test at build time to ensure the wheel installs and Bio can be imported
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl && python3 -c "import Bio; print(Bio.__version__)"
FROM python:3.10-slim-bullseye as runtime
# Runtime libraries required by compiled extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g libbz2-1.0 liblzma5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /wheelhouse /wheelhouse
# Install Biopython from the wheel
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl
# Neutral placeholder CMD to indicate container is ready
CMD ["sh", "-lc", "echo Biopython container ready"]
Smoke [FAIL]: python -c \"import Bio; print(Bio.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python -c \"import Bio; from Bio.Seq import Seq; s = Seq('ACGT'); print(s.__class__.__name__)\
Output: sh: 1: Syntax error: "(" unexpected# Multistage Docker build: build from source, then install wheel in runtime image
FROM python:3.10-slim-bullseye as builder
WORKDIR /src
# Copy the full repository (Biopython source)
COPY . /src/
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential python3-dev zlib1g-dev libbz2-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip tooling
RUN python -m pip install --upgrade pip setuptools wheel
# Build a wheel for Biopython to install in a lean runtime image
RUN python -m pip wheel . -w /wheelhouse
FROM python:3.10-slim-bullseye as runtime
# Runtime libraries required by compiled extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g libbz2-1.0 liblzma5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /wheelhouse /wheelhouse
# Install Biopython from the wheel
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl
# Smoke test: create a small script that prints the Biopython version
RUN printf 'import Bio\nprint(Bio.__version__)\n' > /smoke_bio.py
# Final default command: run smoke test and then keep container alive
CMD ["bash", "-lc", "python3 /smoke_bio.py; tail -f /dev/null"]
Smoke [FAIL]: python -c 'import Bio; print(Bio.__version__)
Output: sh: 1: Syntax error: Unterminated quoted string
Smoke [FAIL]: python -c 'from Bio.Seq import Seq; s = Seq("ACGT"); print(len(s))
Output: sh: 1: Syntax error: Unterminated quoted string# Multistage Docker build: build from source, then install wheel in runtime image
FROM python:3.10-slim-bullseye as builder
WORKDIR /src
# Copy the full repository (Biopython source)
COPY . /src/
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential python3-dev zlib1g-dev libbz2-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip tooling
RUN python -m pip install --upgrade pip setuptools wheel
# Build a wheel for Biopython to install in a lean runtime image
RUN python -m pip wheel . -w /wheelhouse
FROM python:3.10-slim-bullseye as runtime
# Runtime libraries required by compiled extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g libbz2-1.0 liblzma5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /wheelhouse /wheelhouse
# Install Biopython from the wheel
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl
# Create a smoke-test helper script to verify Biopython at runtime without -c quoting
RUN printf '#!/bin/sh\npython3 - <<\'PY\'\nimport Bio\nprint(Bio.__version__)\nPY\n' > /bio_smoke.sh \
&& chmod +x /bio_smoke.sh
# Default command just runs the smoke script; adjust as needed
CMD ["/bin/sh", "-lc", "/bio_smoke.sh"]
Error summary
- Exact error message and exit code
- /bin/sh: 1: Syntax error: "(" unexpected
- Exit code: 2
- Failing command/step
- [runtime 6/6] RUN printf '#!/bin/sh\npython3 - <<\'PY\'\nimport Bio\nprint(Bio.__version__)\nPY\n' > /bio_smoke.sh && chmod +x /bio_smoke.sh
- Missing packages or files mentioned
- None explicitly reported as missing; failure occurs during generation of the /bio_smoke.sh script due to shell syntax.
- Version mismatch info
- No version mismatch reported. Base image uses Python 3.10 (python:3.10-slim-bullseye); Biopython wheel built for cp310; numpy wheel cp310; all aligned with Python 3.10.# Multistage Docker build: build from source, then install wheel in runtime image
FROM python:3.10-slim-bullseye as builder
WORKDIR /src
# Copy the full repository (Biopython source)
COPY . /src/
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential python3-dev zlib1g-dev libbz2-dev liblzma-dev \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip tooling
RUN python -m pip install --upgrade pip setuptools wheel
# Build a wheel for Biopython to install in a lean runtime image
RUN python -m pip wheel . -w /wheelhouse
FROM python:3.10-slim-bullseye as runtime
# Runtime libraries required by compiled extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
zlib1g libbz2-1.0 liblzma5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built wheel from builder stage
COPY --from=builder /wheelhouse /wheelhouse
# Install Biopython from the wheel
RUN python -m pip install --no-cache-dir /wheelhouse/biopython-*.whl
# Create a smoke-test script to verify Biopython at runtime
RUN printf '#!/usr/bin/env python3\nimport Bio\nprint(Bio.__version__)\n' > /bio_smoke.py \
&& chmod +x /bio_smoke.py
# Default command: run the smoke test
CMD ["python3", "/bio_smoke.py"]
Smoke [FAIL]: python3 -c \"import Bio; print('BIO_VERSION', Bio.__version__)\
Output: sh: 1: Syntax error: word unexpected (expecting ")")
Smoke [FAIL]: python3 -c \"import Bio.Seq; print('BIO_SEQ_OK')\
Output: sh: 1: Syntax error: word unexpected (expecting ")")