diff --git a/apps/openchallenges/api-gateway/project.json b/apps/openchallenges/api-gateway/project.json index 4efd0fe3fe..87e6b9ef8d 100644 --- a/apps/openchallenges/api-gateway/project.json +++ b/apps/openchallenges/api-gateway/project.json @@ -67,18 +67,6 @@ }, "dependsOn": ["^install"] }, - "build-image": { - "executor": "@nx-tools/nx-container:build", - "options": { - "context": "apps/openchallenges/api-gateway", - "metadata": { - "images": ["ghcr.io/sage-bionetworks/openchallenges-api-gateway"], - "tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"] - }, - "push": false - }, - "dependsOn": ["build-image-base"] - }, "publish-image": { "executor": "@nx-tools/nx-container:build", "options": { diff --git a/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-image-target.ts b/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-image-target.ts index 0031e95777..7769f378c8 100644 --- a/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-image-target.ts +++ b/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-image-target.ts @@ -1,9 +1,22 @@ import { TargetConfiguration } from '@nx/devkit'; +import { ProjectBuilder } from './project-builder'; export async function buildImageTarget( projectRoot: string, projectName: string, + projectBuilder: ProjectBuilder | undefined, ): Promise { + const dependsOn = [ + { + target: 'build', + }, + ]; + if (projectBuilder === 'gradle') { + dependsOn.push({ + target: 'build-image-base', + }); + } + return { executor: '@nx-tools/nx-container:build', outputs: [], @@ -28,6 +41,6 @@ export async function buildImageTarget( }, }, defaultConfiguration: 'local', - dependsOn: ['build'], + dependsOn, }; } diff --git a/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-project-configuration.ts b/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-project-configuration.ts index 8a640582ab..badc33c2fe 100644 --- a/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-project-configuration.ts +++ b/libs/sage-monorepo/nx-sage-monorepo/src/plugins/build-project-configuration.ts @@ -14,6 +14,7 @@ export async function buildProjectConfiguration( targets[pluginConfig.buildImageTargetName] = await buildImageTarget( options.projectRoot, options.projectName, + options.projectBuilder, ); }