FROM python:3.12-slim
LABEL maintainer="Requests project"
ENV PYTHONUNBUFFERED=1
# Install build dependencies needed to build from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libssl-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the repository source
COPY . .
# Ensure build tooling is up to date
RUN python -m pip install --upgrade pip setuptools wheel
# Build and install the project from source
RUN pip install --no-cache-dir .
# Basic smoke test to verify installation
CMD ["python", "-c", "import requests, sys; print(requests.__version__); print('OK')"]
__pycache__/ *.pyc *.pyo *.pyd venv/ env/ build/ dist/ *.egg-info/ .eggs/ *.egg .eggs *.log *.tmp *.swp *.lock .git/ *.vs/ *.venv/ .
Smoke [FAIL]: python -c "import requests, sys; print(requests.__version__); print('OK')
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.12-slim
LABEL maintainer="Requests project"
ENV PYTHONUNBUFFERED=1
# Install build dependencies needed to build from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libssl-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the repository source
COPY . .
# Ensure build tooling is up to date
RUN python -m pip install --upgrade pip setuptools wheel
# Build and install the project from source
RUN pip install --no-cache-dir .
# Basic smoke test to verify installation
CMD ["python", "-c", "import requests, sys; print(requests.__version__); print(\"OK\")"]
Smoke [FAIL]: python -c 'import requests; print(requests.__version__); print("OK")
Output: sh: 1: Syntax error: Unterminated quoted stringFROM python:3.12-slim
LABEL maintainer="Requests project"
ENV PYTHONUNBUFFERED=1
# Install build dependencies needed to build from source
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libssl-dev \
libffi-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the repository source
COPY . .
# Ensure build tooling is up to date
RUN python -m pip install --upgrade pip setuptools wheel
# Build and install the project from source
RUN pip install --no-cache-dir .
# Create a small verify script to ensure the package can be imported
RUN bash -lc 'cat > /verify.py << "PY"
import requests
print(requests.__version__)
print("OK")
PY
'
# Basic smoke test to verify installation via script
CMD ["python", "/verify.py"]
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 861B done
#1 DONE 0.0s
Dockerfile:29
--------------------
27 | # Create a small verify script to ensure the package can be imported
28 | RUN bash -lc 'cat > /verify.py << "PY"
29 | >>> import requests
30 | print(requests.__version__)
31 | print("OK")
--------------------
ERROR: failed to build: failed to solve: dockerfile parse error on line 29: unknown instruction: import