Skip to content

Commit

Permalink
[backend] Build and push docker images in ghcr.io (#9545)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-julien authored Jan 9, 2025
1 parent b9c212e commit a222b52
Showing 1 changed file with 76 additions and 34 deletions.
110 changes: 76 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,21 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-platform
name: Build Docker image opencti/platform
command: |
LATEST_SEMANTIC_VERSION=$(git tag --sort=-v:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
TAGS="-t opencti/platform:${CIRCLE_TAG}"
[ "$CIRCLE_TAG" = "$LATEST_SEMANTIC_VERSION" ] && TAGS="$TAGS -t opencti/platform:latest"
docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_circleci $TAGS --push .
DOCKER_TAGS="-t opencti/platform:${CIRCLE_TAG}"
[ "$CIRCLE_TAG" = "$LATEST_SEMANTIC_VERSION" ] && DOCKER_TAGS="$DOCKER_TAGS -t opencti/platform:latest"
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_circleci $DOCKER_TAGS --push .
GHCR_TAGS="-t ghcr.io/opencti-platform/opencti/platform:${CIRCLE_TAG}"
[ "$CIRCLE_TAG" = "$LATEST_SEMANTIC_VERSION" ] && GHCR_TAGS="$GHCR_TAGS -t ghcr.io/opencti-platform/opencti/platform:latest"
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_circleci $GHCR_TAGS --push .
no_output_timeout: 30m
- slack/notify:
event: fail
Expand Down Expand Up @@ -280,16 +285,21 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-worker
name: Build Docker image opencti/worker
command: |
LATEST_SEMANTIC_VERSION=$(git tag --sort=-v:refname | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
TAGS="-t opencti/worker:${CIRCLE_TAG}"
[ "$CIRCLE_TAG" = "$LATEST_SEMANTIC_VERSION" ] && TAGS="$TAGS -t opencti/worker:latest"
docker buildx build --platform $BUILDX_PLATFORMS $TAGS --push .
DOCKER_TAGS="-t opencti/worker:${CIRCLE_TAG}"
[ "$CIRCLE_TAG" = "$LATEST_SEMANTIC_VERSION" ] && DOCKER_TAGS="$DOCKER_TAGS -t opencti/worker:latest"
docker buildx build --platform $BUILDX_PLATFORMS $DOCKER_TAGS --push .
GHCR_TAGS="-t ghcr.io/opencti-platform/opencti/worker:${CIRCLE_TAG}"
[ "$CIRCLE_TAG" = "$LATEST_SEMANTIC_VERSION" ] && GHCR_TAGS="$GHCR_TAGS -t ghcr.io/opencti-platform/opencti/worker:latest"
docker buildx build --platform $BUILDX_PLATFORMS $GHCR_TAGS --push .
- slack/notify:
event: fail
template: basic_fail_1
Expand Down Expand Up @@ -324,12 +334,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-platform
name: Build Docker image opencti/platform
command: docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_circleci_fips -t opencti/platform:latest-fips -t opencti/platform:${CIRCLE_TAG}-fips --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_circleci_fips -t opencti/platform:latest-fips -t opencti/platform:${CIRCLE_TAG}-fips --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_circleci_fips -t ghcr.io/opencti-platform/opencti/platform:latest-fips -t ghcr.io/opencti-platform/opencti/platform:${CIRCLE_TAG}-fips --push .
no_output_timeout: 30m
- slack/notify:
event: fail
Expand Down Expand Up @@ -365,12 +379,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-worker
name: Build Docker image opencti/worker
command: docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_fips -t opencti/worker:latest-fips -t opencti/worker:${CIRCLE_TAG}-fips --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_fips -t opencti/worker:latest-fips -t opencti/worker:${CIRCLE_TAG}-fips --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_fips -t ghcr.io/opencti-platform/opencti/worker:latest-fips -t ghcr.io/opencti-platform/opencti/worker:${CIRCLE_TAG}-fips --push .
- slack/notify:
event: fail
template: basic_fail_1
Expand Down Expand Up @@ -408,12 +426,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-platform
name: Build Docker image opencti/platform
command: docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_circleci -t opencti/platform:rolling --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_circleci -t opencti/platform:rolling --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_circleci -t ghcr.io/opencti-platform/opencti/platform:rolling --push .
no_output_timeout: 30m
- slack/notify:
event: fail
Expand Down Expand Up @@ -452,12 +474,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-worker
name: Build Docker image opencti/worker
command: docker buildx build --platform $BUILDX_PLATFORMS -t opencti/worker:rolling --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -t opencti/worker:rolling --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -t ghcr.io/opencti-platform/opencti/worker:rolling --push .
- slack/notify:
event: fail
template: basic_fail_1
Expand Down Expand Up @@ -495,12 +521,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-platform
name: Build Docker image opencti/platform
command: docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_circleci -t opencti/platform:prerelease --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_circleci -t opencti/platform:prerelease --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_circleci -t ghcr.io/opencti-platform/opencti/platform:prerelease --push .
no_output_timeout: 30m
- slack/notify:
event: fail
Expand Down Expand Up @@ -539,12 +569,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-worker
name: Build Docker image opencti/worker
command: docker buildx build --platform $BUILDX_PLATFORMS -t opencti/worker:prerelease --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -t opencti/worker:prerelease --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -t ghcr.io/opencti-platform/opencti/worker:prerelease --push .
- slack/notify:
event: fail
template: basic_fail_1
Expand Down Expand Up @@ -579,12 +613,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-platform
name: Build Docker image opencti/platform
command: docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_circleci_fips -t opencti/platform:rolling-fips --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_circleci_fips -t opencti/platform:rolling-fips --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_circleci_fips -t ghcr.io/opencti-platform/opencti/platform:rolling-fips --push .
no_output_timeout: 30m
- slack/notify:
event: fail
Expand Down Expand Up @@ -620,12 +658,16 @@ jobs:
docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS"
docker buildx create --name mybuilder --use
- run:
name: Login
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
name: Login to docker hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
echo "$GHCR_PASS" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
- run:
working_directory: ~/opencti_docker/opencti-worker
name: Build Docker image opencti/worker
command: docker buildx build --platform $BUILDX_PLATFORMS -f Dockerfile_fips -t opencti/worker:rolling-fips --push .
command: |
docker buildx build --platform $BUILDX_PLATFORMS --cache-to=type=local,dest=.cache -f Dockerfile_fips -t opencti/worker:rolling-fips --push .
docker buildx build --platform $BUILDX_PLATFORMS --cache-from=type=local,src=.cache -f Dockerfile_fips -t ghcr.io/opencti-platform/opencti/worker:rolling-fips --push .
- slack/notify:
event: fail
template: basic_fail_1
Expand Down

0 comments on commit a222b52

Please sign in to comment.