Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for python 3.11 and 3.12 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ env:
"latest",

"BANDIT-latest PYTHON-latest",
"BANDIT-latest PYTHON-3.12",
"BANDIT-latest PYTHON-3.11",
"BANDIT-latest PYTHON-3.10",
"BANDIT-latest PYTHON-3.9",
"BANDIT-latest PYTHON-3.8",
"BANDIT-latest PYTHON-3.7",

"BANDIT-1 PYTHON-latest",
"BANDIT-1 PYTHON-3.12",
"BANDIT-1 PYTHON-3.11",
"BANDIT-1 PYTHON-3.10",
"BANDIT-1 PYTHON-3.9",
"BANDIT-1 PYTHON-3.8",
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile.latest
4 changes: 2 additions & 2 deletions Dockerfiles/Dockerfile.python3.10
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.16 as builder
FROM alpine:3.17 as builder

RUN set -eux \
&& apk add --no-cache \
Expand Down Expand Up @@ -28,7 +28,7 @@ RUN set -eux \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf


FROM alpine:3.16 as production
FROM alpine:3.17 as production
ARG BANDIT_VERSION
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
#LABEL "org.opencontainers.image.created"=""
Expand Down
58 changes: 58 additions & 0 deletions Dockerfiles/Dockerfile.python3.11
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM alpine:3.19 as builder

RUN set -eux \
&& apk add --no-cache \
bc \
gcc \
libxml2-dev \
libxslt-dev \
musl-dev \
py3-pip \
python3 \
python3-dev

ARG BANDIT_VERSION
RUN set -eux \
&& if [ "${BANDIT_VERSION}" = "latest" ]; then \
pip3 install --no-cache-dir --no-compile --break-system-packages bandit; \
else \
pip3 install --no-cache-dir --no-compile --break-system-packages "bandit>=${BANDIT_VERSION},<$(echo "${BANDIT_VERSION}+1" | bc)"; \
fi \
\
&& bandit --version | grep -E '^bandit\s[0-9]+' \
\
&& pip3 install --no-cache-dir --break-system-packages \
lxml \
\
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf


FROM alpine:3.19 as production
ARG BANDIT_VERSION
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
#LABEL "org.opencontainers.image.created"=""
#LABEL "org.opencontainers.image.version"=""
#LABEL "org.opencontainers.image.revision"=""
LABEL "maintainer"="cytopia <[email protected]>"
LABEL "org.opencontainers.image.authors"="cytopia <[email protected]>"
LABEL "org.opencontainers.image.vendor"="cytopia"
LABEL "org.opencontainers.image.licenses"="MIT"
LABEL "org.opencontainers.image.url"="https://github.com/cytopia/docker-bandit"
LABEL "org.opencontainers.image.documentation"="https://github.com/cytopia/docker-bandit"
LABEL "org.opencontainers.image.source"="https://github.com/cytopia/docker-bandit"
LABEL "org.opencontainers.image.ref.name"="bandit ${BANDIT_VERSION}"
LABEL "org.opencontainers.image.title"="bandit ${BANDIT_VERSION}"
LABEL "org.opencontainers.image.description"="bandit ${BANDIT_VERSION}"

RUN set -eux \
&& apk add --no-cache \
python3 \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf

COPY --from=builder /usr/lib/python3.11/site-packages/ /usr/lib/python3.11/site-packages/
COPY --from=builder /usr/bin/bandit /usr/bin/bandit
WORKDIR /data
ENTRYPOINT ["bandit"]
58 changes: 58 additions & 0 deletions Dockerfiles/Dockerfile.python3.12
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM alpine:3.21 as builder

RUN set -eux \
&& apk add --no-cache \
bc \
gcc \
libxml2-dev \
libxslt-dev \
musl-dev \
py3-pip \
python3 \
python3-dev

ARG BANDIT_VERSION
RUN set -eux \
&& if [ "${BANDIT_VERSION}" = "latest" ]; then \
pip3 install --no-cache-dir --no-compile --break-system-packages bandit; \
else \
pip3 install --no-cache-dir --no-compile --break-system-packages "bandit>=${BANDIT_VERSION},<$(echo "${BANDIT_VERSION}+1" | bc)"; \
fi \
\
&& bandit --version | grep -E '^bandit\s[0-9]+' \
\
&& pip3 install --no-cache-dir --break-system-packages \
lxml \
\
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf


FROM alpine:3.21 as production
ARG BANDIT_VERSION
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
#LABEL "org.opencontainers.image.created"=""
#LABEL "org.opencontainers.image.version"=""
#LABEL "org.opencontainers.image.revision"=""
LABEL "maintainer"="cytopia <[email protected]>"
LABEL "org.opencontainers.image.authors"="cytopia <[email protected]>"
LABEL "org.opencontainers.image.vendor"="cytopia"
LABEL "org.opencontainers.image.licenses"="MIT"
LABEL "org.opencontainers.image.url"="https://github.com/cytopia/docker-bandit"
LABEL "org.opencontainers.image.documentation"="https://github.com/cytopia/docker-bandit"
LABEL "org.opencontainers.image.source"="https://github.com/cytopia/docker-bandit"
LABEL "org.opencontainers.image.ref.name"="bandit ${BANDIT_VERSION}"
LABEL "org.opencontainers.image.title"="bandit ${BANDIT_VERSION}"
LABEL "org.opencontainers.image.description"="bandit ${BANDIT_VERSION}"

RUN set -eux \
&& apk add --no-cache \
python3 \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf

COPY --from=builder /usr/lib/python3.12/site-packages/ /usr/lib/python3.12/site-packages/
COPY --from=builder /usr/bin/bandit /usr/bin/bandit
WORKDIR /data
ENTRYPOINT ["bandit"]
60 changes: 34 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,23 @@ The following Docker image tags are rolling releases and are built and updated e
[![nightly](https://github.com/cytopia/docker-bandit/workflows/nightly/badge.svg)](https://github.com/cytopia/docker-bandit/actions?query=workflow%3Anightly)


| Docker Tag | Git Ref | Bandit | Python | Available Architectures |
|-----------------------|--------------|--------------|-------------|----------------------------------------------|
| **`latest`** | master | latest | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.10` | master | latest | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.9` | master | latest | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.8` | master | latest | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.7` | master | latest | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| | | | | |
| **`1`** | master | **`1.x.x`** | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.10` | master | **`1.x.x`** | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.9` | master | **`1.x.x`** | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.8` | master | **`1.x.x`** | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.7` | master | **`1.x.x`** | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| Docker Tag | Git Ref | Bandit | Python | Available Architectures |
|-----------------|--------------|--------------|------------|----------------------------------------------|
| **`latest`** | master | latest | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.12` | master | latest | **`3.12`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.11` | master | latest | **`3.11`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.10` | master | latest | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.9` | master | latest | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.8` | master | latest | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.7` | master | latest | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| | | | | |
| **`1`** | master | **`1.x.x`** | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.12` | master | **`1.x.x`** | **`3.12`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.11` | master | **`1.x.x`** | **`3.11`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.10` | master | **`1.x.x`** | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.9` | master | **`1.x.x`** | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.8` | master | **`1.x.x`** | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.7` | master | **`1.x.x`** | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |


#### Point in time releases
Expand All @@ -82,19 +86,23 @@ The following Docker image tags are built once and can be used for reproducible

[![build](https://github.com/cytopia/docker-bandit/workflows/build/badge.svg)](https://github.com/cytopia/docker-bandit/actions?query=workflow%3Abuild)

| Docker Tag | Git Ref | Bandit | Python | Available Architectures |
|-----------------------|--------------|--------------|-------------|----------------------------------------------|
| **`latest-<tag>`** | git: `<tag>` | latest | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.10-<tag>` | git: `<tag>` | latest | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.9-<tag>` | git: `<tag>` | latest | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.8-<tag>` | git: `<tag>` | latest | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.7-<tag>` | git: `<tag>` | latest | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| | | | | |
| **`1-<tag>`** | git: `<tag>` | **`1.x.x`** | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.10-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.9-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.8-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.7-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| Docker Tag | Git Ref | Bandit | Python | Available Architectures |
|-----------------------|--------------|--------------|------------|----------------------------------------------|
| **`latest-<tag>`** | git: `<tag>` | latest | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.12-<tag>` | git: `<tag>` | latest | **`3.12`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.11-<tag>` | git: `<tag>` | latest | **`3.11`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.10-<tag>` | git: `<tag>` | latest | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.9-<tag>` | git: `<tag>` | latest | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.8-<tag>` | git: `<tag>` | latest | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `latest-py3.7-<tag>` | git: `<tag>` | latest | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| | | | | |
| **`1-<tag>`** | git: `<tag>` | **`1.x.x`** | latest | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.12-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.12`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.11-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.11`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.10-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.10`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.9-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.9`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.8-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.8`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| `1-py3.7-<tag>` | git: `<tag>` | **`1.x.x`** | **`3.7`** | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |

> Where `<tag>` refers to the chosen git tag from this repository.

Expand Down