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

Commit f5e4123

Browse files
committed
fix
1 parent ff64127 commit f5e4123

File tree

2 files changed

+34
-49
lines changed

2 files changed

+34
-49
lines changed

.circleci/config.yml

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ orbs:
44
slack: circleci/[email protected]
55
ms-teams: cloudradar-monitoring/[email protected]
66
env:
7-
BASE_REPO: opencti
7+
DOCKER_REPO: opencti
8+
GHCR_REPO: ghcr.io/OpenCTI-Platform/client-python
89
jobs:
910
ensure_formatting:
1011
docker:
@@ -50,55 +51,41 @@ jobs:
5051
- ms-teams/report:
5152
only_on_fail: true
5253
webhook_url: $MS_TEAMS_WEBHOOK_URL
53-
build-container-python-3-11:
54-
docker:
55-
- image: cimg/base:stable-20.04
54+
55+
build-container:
56+
executor: docker/docker
57+
parameters:
58+
python_version:
59+
type: string
5660
steps:
5761
- checkout
58-
- setup_remote_docker
62+
- setup_remote_docker:
63+
docker_layer_caching: true
5964
- run:
60-
name: Build opencti/python-client-container
65+
name: Setup Docker Buildx
6166
command: |
62-
docker run --privileged --rm tonistiigi/binfmt --install all
63-
CIRCLE_TAG=${CIRCLE_TAG:-nightly}
64-
echo "CIRCLE_TAG=${CIRCLE_TAG}"
65-
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
66-
docker buildx create --platform linux/amd64,linux/arm64 --use --name mybuilder || true
67-
docker buildx inspect mybuilder --bootstrap
68-
docker buildx build . \
69-
--platform linux/amd64,linux/arm64 \
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-
67+
docker buildx create --driver docker-container --name multiarch --use
68+
- run:
69+
name: Login to Docker Hub
70+
command: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
7471
- run:
75-
name: Push image to regsitry
76-
command: docker push ${{ env.BASE_REPO }}/client-python-3-11:latest --all-tags
72+
name: Login to GitHub Container Registry
73+
command: echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
7774

78-
build-container-python-3-12:
79-
docker:
80-
- image: cimg/base:stable-20.04
81-
steps:
82-
- checkout
83-
- setup_remote_docker
8475
- run:
85-
name: Build opencti/python-client
76+
name: Build and Push Alpine Multi-arch Image
8677
command: |
87-
docker run --privileged --rm tonistiigi/binfmt --install all
88-
CIRCLE_TAG=${CIRCLE_TAG:-nightly}
89-
echo "CIRCLE_TAG=${CIRCLE_TAG}"
90-
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
91-
docker buildx create --platform linux/amd64,linux/arm64 --use --name mybuilder || true
92-
docker buildx inspect mybuilder --bootstrap
93-
docker buildx build . \
78+
VERSION=${CIRCLE_TAG:-latest}
79+
PYTHON_VERSION_TAG=$(echo "<< parameters.python_version >>" | sed 's/\./-/g')
80+
docker buildx build \
9481
--platform linux/amd64,linux/arm64 \
95-
-t ${{ env.BASE_REPO }}/client-python-3-12:${CIRCLE_TAG} \
96-
-t ${{ env.BASE_REPO }}/client-python-3-12:latest \
97-
--build-arg BASE_IMAGE="python:3.12-alpine3.20"
98-
99-
- run:
100-
name: Push image to regsitry
101-
command: docker push ${{ env.BASE_REPO }}/client-python-3-12:latest --all-tags
82+
--file Dockerfile.alpine \
83+
--tag ${{ env.DOCKER_REPO }}/client-python-${PYTHON_VERSION_TAG}:${VERSION} \
84+
--tag ${{ env.DOCKER_REPO }}/client-python-${PYTHON_VERSION_TAG}:latest \
85+
--tag ${{ env.GHCR_REPO }}/client-python-${PYTHON_VERSION_TAG}:${VERSION} \
86+
--tag ${{ env.GHCR_REPO }}/client-python-${PYTHON_VERSION_TAG}:latest \
87+
--push \
88+
--file Dockerfile
10289
10390
build-library:
10491
working_directory: ~/opencti-client
@@ -196,18 +183,17 @@ workflows:
196183
filters:
197184
tags:
198185
only: /.*/
199-
- build-container-python-3-11:
200-
requires:
201-
- build-library
202-
filters:
203-
tags:
204-
only: /[0-9]+(\.[0-9]+)+(\.[0-9]+)?\.?(\w)*/
205-
- build-container-python-3-12:
186+
187+
- build-container:
188+
matrix:
189+
parameters:
190+
python_version: ["3.11", "3.12"]
206191
requires:
207192
- build-library
208193
filters:
209194
tags:
210195
only: /[0-9]+(\.[0-9]+)+(\.[0-9]+)?\.?(\w)*/
196+
211197
- build-library:
212198
filters:
213199
tags:

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ ARG BASE_IMAGE="python:3.12-alpine3.20"
22
FROM ${BASE_IMAGE}
33

44
# Install Python modules
5-
# hadolint ignore=DL3003
65
COPY ./requirements.txt /opt/requirements.txt
76

87
RUN apk --no-cache add git build-base libmagic libffi-dev && \

0 commit comments

Comments
 (0)