1111 description : " Reference of the branch or commit sha"
1212 type : string
1313 default : ${{ github.sha }}
14- client_python_local :
14+ dockerfile_target :
15+ description : " Target to build in the multi stage docker file - testing or app"
16+ type : string
17+ required : false
18+ default : app
19+ is_client_python_local :
1520 description : " Use client python from the same commit"
1621 type : boolean
1722 required : false
1823 default : false
19- dockerfile_target :
20- description : " Target to build in the multi stage docker file - testing or app "
24+ is_fips :
25+ description : " Registry used to publish the image "
2126 type : string
2227 required : false
23- default : app
24- publish_to_registry :
28+ default : false
29+ is_publish_to_registry :
2530 description : " Publish image to registry. If false, will save the image as github artifact"
2631 type : string
2732 required : false
5358 ref : ${{ inputs.checkout_ref }}
5459
5560 - name : Use client-python in OpenCTI from same branch
56- if : ${{ inputs.client_python_local == true }}
61+ if : ${{ inputs.is_client_python_local == true }}
5762 run : sed -i 's|^pycti==.*$|pycti @ git+https://github.com/OpenCTI-Platform/opencti@${{ inputs.checkout_ref }}#subdirectory=client-python|' -i ./opencti-platform/opencti-graphql/src/python/requirements.txt
5863
5964 - name : Set up Docker Buildx
6267 name : gha-builder-platform
6368
6469 - name : Login to DockerHub
65- if : inputs.publish_to_registry == 'true'
70+ if : inputs.is_publish_to_registry == 'true'
6671 uses : docker/login-action@v3
6772 with :
6873 username : ${{ secrets.DOCKERHUB_USERNAME }}
@@ -73,21 +78,23 @@ jobs:
7378 uses : docker/metadata-action@v5
7479 with :
7580 images : ${{ inputs.registry }}/platform
76- tags : type=raw,value=${{ inputs.image_tag }}
81+ tags : type=raw,value=${{ inputs.image_tag }}${{ inputs.fips && '-fips' }}
7782
78- - name : Build and ${{ inputs.publish_to_registry && 'push' || 'export as tar' }}
83+ - name : Build and ${{ inputs.is_publish_to_registry && 'push' || 'export as tar' }}
7984 uses : docker/build-push-action@v6
8085 with :
8186 context : opencti-platform
8287 file : opencti-platform/Dockerfile_featurebranch
8388 target : ${{ inputs.dockerfile_target }}
84- push : ${{ inputs.publish_to_registry == 'true' }}
85- outputs : ${{ inputs.publish_to_registry == 'false' && 'type=docker,dest=/tmp/opencti-platform.tar' }}
89+ build-args : |
90+ "BASE_TYPE= ${{ inputs.fips && 'fips' || 'alpine' }}"
91+ push : ${{ inputs.is_publish_to_registry == 'true' }}
92+ outputs : ${{ inputs.is_publish_to_registry == 'false' && 'type=docker,dest=/tmp/opencti-platform.tar' }}
8693 tags : ${{ steps.meta.outputs.tags }}
8794 labels : ${{ steps.meta.outputs.labels }}
8895
8996 - name : Upload opencti docker image artifact
90- if : ${{ inputs.publish_to_registry == 'false' }}
97+ if : ${{ inputs.is_publish_to_registry == 'false' }}
9198 uses : actions/upload-artifact@v4
9299 with :
93100 name : docker-image-opencti-platform
@@ -107,7 +114,7 @@ jobs:
107114 ref : ${{ inputs.checkout_ref }}
108115
109116 - name : Use client-python in worker from same branch
110- if : ${{ inputs.client_python_local == true }}
117+ if : ${{ inputs.is_client_python_local == true }}
111118 run : sed -i 's|^pycti==.*$|pycti @ git+https://github.com/OpenCTI-Platform/opencti@${{ inputs.checkout_ref }}#subdirectory=client-python|' -i ./opencti-worker/src/requirements.txt
112119
113120 - name : Set up Docker Buildx
@@ -116,7 +123,7 @@ jobs:
116123 name : gha-builder-worker
117124
118125 - name : Login to DockerHub
119- if : inputs.publish_to_registry == 'true'
126+ if : inputs.is_publish_to_registry == 'true'
120127 uses : docker/login-action@v3
121128 with :
122129 username : ${{ secrets.DOCKERHUB_USERNAME }}
@@ -127,15 +134,17 @@ jobs:
127134 uses : docker/metadata-action@v5
128135 with :
129136 images : ${{ inputs.registry }}/worker
130- tags : type=raw,value=${{ inputs.image_tag }}
137+ tags : type=raw,value=${{ inputs.image_tag }}${{ inputs.fips && '-fips' }}
131138
132- - name : Build and ${{ inputs.publish_to_registry && 'push' || 'export as tar' }}
139+ - name : Build and ${{ inputs.is_publish_to_registry && 'push' || 'export as tar' }}
133140 uses : docker/build-push-action@v6
134141 with :
135142 context : opencti-worker
136143 file : opencti-worker/Dockerfile
137- push : ${{ inputs.publish_to_registry == 'true' }}
138- outputs : ${{ inputs.publish_to_registry == 'false' && 'type=docker,dest=/tmp/opencti-worker.tar' }}
144+ build-args : |
145+ "BASE_TYPE= ${{ inputs.fips && 'fips' || 'alpine' }}"
146+ push : ${{ inputs.is_publish_to_registry == 'true' }}
147+ outputs : ${{ inputs.is_publish_to_registry == 'false' && 'type=docker,dest=/tmp/opencti-worker.tar' }}
139148 tags : ${{ steps.meta.outputs.tags }}
140149 labels : ${{ steps.meta.outputs.labels }}
141150
0 commit comments