-
Notifications
You must be signed in to change notification settings - Fork 131
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
[CI] Add container build #804
Open
Renizmy
wants to merge
17
commits into
OpenCTI-Platform:master
Choose a base branch
from
Renizmy:ci/add-container-build
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
82ee154
⚡️ First shot
Renizmy 8cedf2b
⚡️ First shot
Renizmy 0876312
⚡️ First shot
Renizmy e6482c0
⚡️ First shot
Renizmy 948e6e7
⚡️ First shot
Renizmy c5a0cee
⚡️ First shot
Renizmy ec976cc
⚡️ First shot
Renizmy a8d01ea
⚡️ First shot
Renizmy 11083bd
⚡️ First shot
Renizmy 11bc1cd
⚡️ First shot
Renizmy eb91ea8
⚡️ First shot
Renizmy 8bef012
set target platform in builder
Renizmy 4a3e04e
change base repo + change build container trigger
Renizmy cb10a9a
add python 3.11 build + app user + trivy scan
Renizmy dba084d
Add build steps
Renizmy ba3c65b
delete trivy + change workflow
Renizmy ff64127
change workflow
Renizmy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,6 +3,8 @@ version: 2.1 | |||||
orbs: | ||||||
slack: circleci/[email protected] | ||||||
ms-teams: cloudradar-monitoring/[email protected] | ||||||
env: | ||||||
BASE_REPO: opencti | ||||||
jobs: | ||||||
ensure_formatting: | ||||||
docker: | ||||||
|
@@ -48,7 +50,57 @@ jobs: | |||||
- ms-teams/report: | ||||||
only_on_fail: true | ||||||
webhook_url: $MS_TEAMS_WEBHOOK_URL | ||||||
build: | ||||||
build-container-python-3-11: | ||||||
docker: | ||||||
- image: cimg/base:stable-20.04 | ||||||
steps: | ||||||
- checkout | ||||||
- setup_remote_docker | ||||||
- run: | ||||||
name: Build opencti/python-client-container | ||||||
command: | | ||||||
docker run --privileged --rm tonistiigi/binfmt --install all | ||||||
CIRCLE_TAG=${CIRCLE_TAG:-nightly} | ||||||
echo "CIRCLE_TAG=${CIRCLE_TAG}" | ||||||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||||||
docker buildx create --platform linux/amd64,linux/arm64 --use --name mybuilder || true | ||||||
docker buildx inspect mybuilder --bootstrap | ||||||
docker buildx build . \ | ||||||
--platform linux/amd64,linux/arm64 \ | ||||||
-t ${{ env.BASE_REPO }}/client-python-3-11:${CIRCLE_TAG} \ | ||||||
-t ${{ env.BASE_REPO }}client-python-3-11:latest \ | ||||||
--build-arg BASE_IMAGE="python:3.11-alpine3.20" | ||||||
|
||||||
- run: | ||||||
name: Push image to regsitry | ||||||
command: docker push ${{ env.BASE_REPO }}/client-python-3-11:latest --all-tags | ||||||
|
||||||
build-container-python-3-12: | ||||||
docker: | ||||||
- image: cimg/base:stable-20.04 | ||||||
steps: | ||||||
- checkout | ||||||
- setup_remote_docker | ||||||
- run: | ||||||
name: Build opencti/python-client | ||||||
command: | | ||||||
docker run --privileged --rm tonistiigi/binfmt --install all | ||||||
CIRCLE_TAG=${CIRCLE_TAG:-nightly} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Renizmy Thank you for this PR, could you explain this ? What is the purpose of |
||||||
echo "CIRCLE_TAG=${CIRCLE_TAG}" | ||||||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||||||
docker buildx create --platform linux/amd64,linux/arm64 --use --name mybuilder || true | ||||||
docker buildx inspect mybuilder --bootstrap | ||||||
docker buildx build . \ | ||||||
--platform linux/amd64,linux/arm64 \ | ||||||
-t ${{ env.BASE_REPO }}/client-python-3-12:${CIRCLE_TAG} \ | ||||||
-t ${{ env.BASE_REPO }}/client-python-3-12:latest \ | ||||||
--build-arg BASE_IMAGE="python:3.12-alpine3.20" | ||||||
|
||||||
- run: | ||||||
name: Push image to regsitry | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you correct the naming ?
Suggested change
|
||||||
command: docker push ${{ env.BASE_REPO }}/client-python-3-12:latest --all-tags | ||||||
|
||||||
build-library: | ||||||
working_directory: ~/opencti-client | ||||||
docker: | ||||||
- image: cimg/python:3.12 | ||||||
|
@@ -144,26 +196,35 @@ workflows: | |||||
filters: | ||||||
tags: | ||||||
only: /.*/ | ||||||
- build: | ||||||
- build-container-python-3-11: | ||||||
requires: | ||||||
- build-library | ||||||
filters: | ||||||
tags: | ||||||
only: /[0-9]+(\.[0-9]+)+(\.[0-9]+)?\.?(\w)*/ | ||||||
- build-container-python-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 | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ARG BASE_IMAGE="python:3.12-alpine3.20" | ||
FROM ${BASE_IMAGE} | ||
|
||
# Install Python modules | ||
# hadolint ignore=DL3003 | ||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you correct the naming ?