Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.
Closed
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
61 changes: 54 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ version: 2.1
orbs:
slack: circleci/slack@4.13.3
ms-teams: cloudradar-monitoring/ms-teams@0.0.1
env:
DOCKER_REPO: opencti
GHCR_REPO: ghcr.io/OpenCTI-Platform/client-python
jobs:
ensure_formatting:
docker:
Expand Down Expand Up @@ -48,7 +51,43 @@ jobs:
- ms-teams/report:
only_on_fail: true
webhook_url: $MS_TEAMS_WEBHOOK_URL
build:

build-container:
executor: docker/docker
parameters:
python_version:
type: string
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Setup Docker Buildx
command: |
docker buildx create --driver docker-container --name multiarch --use
- run:
name: Login to Docker Hub
command: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- run:
name: Login to GitHub Container Registry
command: echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin

- run:
name: Build and Push Alpine Multi-arch Image
command: |
VERSION=${CIRCLE_TAG:-latest}
PYTHON_VERSION_TAG=$(echo "<< parameters.python_version >>" | sed 's/\./-/g')
docker buildx build \
--platform linux/amd64,linux/arm64 \
--file Dockerfile.alpine \
--tag ${{ env.DOCKER_REPO }}/client-python-${PYTHON_VERSION_TAG}:${VERSION} \
--tag ${{ env.DOCKER_REPO }}/client-python-${PYTHON_VERSION_TAG}:latest \
--tag ${{ env.GHCR_REPO }}/client-python-${PYTHON_VERSION_TAG}:${VERSION} \
--tag ${{ env.GHCR_REPO }}/client-python-${PYTHON_VERSION_TAG}:latest \
--push \
--file Dockerfile

build-library:
working_directory: ~/opencti-client
docker:
- image: cimg/python:3.12
Expand Down Expand Up @@ -144,26 +183,34 @@ workflows:
filters:
tags:
only: /.*/
- build:

- build-container:
matrix:
parameters:
python_version: ["3.11", "3.12"]
requires:
- build-library
filters:
tags:
only: /[0-9]+(\.[0-9]+)+(\.[0-9]+)?\.?(\w)*/

- build-library:
filters:
tags:
only: /[0-9]+(\.[0-9]+)+(\.[0-9]+)?\.?(\w)*/
branches:
ignore: /.*/
requires:
- ensure_formatting
- linter
- deploy:
requires:
- build
- build-library
filters:
tags:
only: /[0-9]+(\.[0-9]+)+(\.[0-9]+)?\.?(\w)*/
branches:
ignore: /.*/
- notify_rolling:
requires:
- build
- build-library
- notify:
requires:
- deploy
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG BASE_IMAGE="python:3.12-alpine3.20"
FROM ${BASE_IMAGE}

# Install Python modules
COPY ./requirements.txt /opt/requirements.txt

RUN apk --no-cache add git build-base libmagic libffi-dev && \
pip3 install --no-cache-dir -r /opt/requirements.txt && \
apk del git build-base && rm /opt/requirements.txt

RUN adduser -D -g '' app
USER app