Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit cb10a9a

Browse files
committed
add python 3.11 build + app user + trivy scan
1 parent 4a3e04e commit cb10a9a

File tree

2 files changed

+61
-7
lines changed

2 files changed

+61
-7
lines changed

.circleci/config.yml

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ version: 2.1
33
orbs:
44
slack: circleci/[email protected]
55
ms-teams: cloudradar-monitoring/[email protected]
6+
env:
7+
BASE_REPO: opencti
68
jobs:
79
ensure_formatting:
810
docker:
@@ -48,27 +50,76 @@ jobs:
4850
- ms-teams/report:
4951
only_on_fail: true
5052
webhook_url: $MS_TEAMS_WEBHOOK_URL
51-
build-container:
53+
build-container-python-3-11:
5254
docker:
5355
- image: cimg/base:stable-20.04
5456
steps:
5557
- checkout
5658
- setup_remote_docker
5759
- run:
58-
name: Build opencti/python-client
60+
name: Build opencti/python-client-container
5961
command: |
6062
docker run --privileged --rm tonistiigi/binfmt --install all
6163
CIRCLE_TAG=${CIRCLE_TAG:-nightly}
6264
echo "CIRCLE_TAG=${CIRCLE_TAG}"
63-
BASE_REPO="opencti"
6465
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
6566
docker buildx create --platform linux/amd64,linux/arm64 --use --name mybuilder || true
6667
docker buildx inspect mybuilder --bootstrap
6768
docker buildx build . \
6869
--platform linux/amd64,linux/arm64 \
69-
-t $BASE_REPO/client-python:${CIRCLE_TAG} \
70-
-t $BASE_REPO/client-python:latest \
71-
--push
70+
-t ${{ env.BASE_REPO }}/client-python-3-11:${CIRCLE_TAG} \
71+
-t ${{ env.BASE_REPO }}client-python-3-11:latest \
72+
--build-arg BASE_IMAGE="python:3.11-alpine3.20" \
73+
74+
- name: Run Trivy vulnerability scanner
75+
uses: aquasecurity/[email protected]
76+
with:
77+
image-ref: ${{ env.BASE_REPO }}/client-python-3-11:latest
78+
format: 'table'
79+
exit-code: '1'
80+
ignore-unfixed: true
81+
vuln-type: 'os,library'
82+
severity: 'CRITICAL,HIGH'
83+
84+
- run:
85+
name: Push image to regsitry
86+
command: docker push ${{ env.BASE_REPO }}/client-python-3-11:latest --all-tags
87+
88+
build-container-python-3-12:
89+
docker:
90+
- image: cimg/base:stable-20.04
91+
steps:
92+
- checkout
93+
- setup_remote_docker
94+
- run:
95+
name: Build opencti/python-client
96+
command: |
97+
docker run --privileged --rm tonistiigi/binfmt --install all
98+
CIRCLE_TAG=${CIRCLE_TAG:-nightly}
99+
echo "CIRCLE_TAG=${CIRCLE_TAG}"
100+
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
101+
docker buildx create --platform linux/amd64,linux/arm64 --use --name mybuilder || true
102+
docker buildx inspect mybuilder --bootstrap
103+
docker buildx build . \
104+
--platform linux/amd64,linux/arm64 \
105+
-t ${{ env.BASE_REPO }}/client-python-3-12:${CIRCLE_TAG} \
106+
-t ${{ env.BASE_REPO }}/client-python-3-12:latest \
107+
--build-arg BASE_IMAGE="python:3.12-alpine3.20" \
108+
109+
- name: Run Trivy vulnerability scanner
110+
uses: aquasecurity/[email protected]
111+
with:
112+
image-ref: ${{ env.BASE_REPO }}/client-python-3-11:latest
113+
format: 'table'
114+
exit-code: '1'
115+
ignore-unfixed: true
116+
vuln-type: 'os,library'
117+
severity: 'CRITICAL,HIGH'
118+
119+
- run:
120+
name: Push image to regsitry
121+
command: docker push ${{ env.BASE_REPO }}/client-python-3-12:latest --all-tags
122+
72123
build-library:
73124
working_directory: ~/opencti-client
74125
docker:

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ COPY ./requirements.txt /opt/requirements.txt
77

88
RUN apk --no-cache add git build-base libmagic libffi-dev && \
99
pip3 install --no-cache-dir -r /opt/requirements.txt && \
10-
apk del git build-base && rm /opt/requirements.txt
10+
apk del git build-base && rm /opt/requirements.txt
11+
12+
RUN adduser -D -g '' app
13+
USER app

0 commit comments

Comments
 (0)