@leverege/build-tools 2.67.3-beta.1 → 2.67.3-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/DockerPy.mjs
CHANGED
|
@@ -161,8 +161,8 @@ async function validateCloudBuildBucket( artifactProject ) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
async function buildContainerImage( {
|
|
164
|
-
artifactProject, artifactRegistry, containerName,
|
|
165
|
-
imageVersion, isNpmWorkspace, options
|
|
164
|
+
artifactProject, artifactRegistry, containerName,
|
|
165
|
+
imageVersion, imagePlatform, isNpmWorkspace, options
|
|
166
166
|
} ) {
|
|
167
167
|
const buildWorkspace = './build/workspace' // passed to Cloud Build
|
|
168
168
|
const imageName = `${artifactRegistry}/images/${containerName}`
|
|
@@ -195,7 +195,7 @@ async function buildContainerImage( {
|
|
|
195
195
|
// build the cloudbuild.yaml from the handlebars template
|
|
196
196
|
const cloudBuildFile = './build/cloudbuild.yaml'
|
|
197
197
|
const cbst = handlebars.compile( cloudBuildSteps, { noEscape : true } )
|
|
198
|
-
const cbs = cbst( { artifactProject, artifactRegistry, imageName, imageVersion, imageInfoTag, } )
|
|
198
|
+
const cbs = cbst( { artifactProject, artifactRegistry, imageName, imageVersion, imageInfoTag, imagePlatform } )
|
|
199
199
|
fs.writeFileSync( cloudBuildFile, cbs )
|
|
200
200
|
|
|
201
201
|
// build up the cloud build command and options
|
|
@@ -91,8 +91,9 @@ const repoDescr = {
|
|
|
91
91
|
containerName : pyproject.project.name,
|
|
92
92
|
packageVersion : `v${pyproject.project.version}`,
|
|
93
93
|
artifactRegistry : pyproject.leverege.registry || 'us-docker.pkg.dev/leverege-registry/stack',
|
|
94
|
-
registryFolder : `${pyproject.leverege['registry-folder']}/images/${pyproject.project.name}`,
|
|
94
|
+
// registryFolder : `${pyproject.leverege['registry-folder']}/images/${pyproject.project.name}`, Not being used
|
|
95
95
|
imageBase : pyproject.leverege['image-base'],
|
|
96
|
+
imagePlatform : pyproject.leverege['image-platform'] || 'linux/amd64',
|
|
96
97
|
helmChart : await parseHelmChart(),
|
|
97
98
|
}
|
|
98
99
|
|
|
@@ -214,6 +215,7 @@ log( `
|
|
|
214
215
|
${chalk.green.bold( 'Build Information:' )}
|
|
215
216
|
Container: ${chalk.green.bold( containerName )}
|
|
216
217
|
Version: ${chalk.green.bold( imageVersion )} ${tagInfo}
|
|
218
|
+
Platform: ${chalk.green.bold( repoDescr.imagePlatform )}
|
|
217
219
|
Registry: ${chalk.green.bold( artifactRegistry )}
|
|
218
220
|
Image Folder: ${chalk.yellow.bold( registryFolder )}
|
|
219
221
|
|
|
@@ -271,7 +273,7 @@ if ( willGitTag ) {
|
|
|
271
273
|
await proceed()
|
|
272
274
|
|
|
273
275
|
log( chalk.green.bold( 'Building the Docker Image...' ) )
|
|
274
|
-
await Docker.buildContainerImage( { ...repoDescr, options, imageVersion } )
|
|
276
|
+
await Docker.buildContainerImage( { ...repoDescr, imagePlatformList : [ repoDescr.imagePlatform.split( '/' )[0] ], options, imageVersion } )
|
|
275
277
|
log( chalk.blue.bold( 'Done Building the Docker Image...' ) )
|
|
276
278
|
|
|
277
279
|
if ( willGitTag ) {
|
|
@@ -2,14 +2,20 @@ options:
|
|
|
2
2
|
machineType: E2_HIGHCPU_8
|
|
3
3
|
|
|
4
4
|
steps:
|
|
5
|
+
{{#each imagePlatformList}}
|
|
5
6
|
- name: 'gcr.io/cloud-builders/docker'
|
|
6
7
|
entrypoint: 'bash'
|
|
7
|
-
args: ['-c', 'docker pull {{imageName}}:latest || exit 0']
|
|
8
|
+
args: ['-c', 'docker pull --platform={{this}} {{imageName}}:latest || exit 0']
|
|
9
|
+
waitFor: ['-']
|
|
10
|
+
{{/each}}
|
|
11
|
+
|
|
12
|
+
- name: 'gcr.io/cloud-builders/docker'
|
|
13
|
+
args: ['buildx', 'create', '--driver', 'docker-container', '--name', 'container', '--driver-opt', 'network=cloudbuild', '--use']
|
|
8
14
|
|
|
9
15
|
- name: 'gcr.io/cloud-builders/docker'
|
|
10
16
|
args:
|
|
17
|
+
- 'buildx'
|
|
11
18
|
- 'build'
|
|
12
|
-
- '--platform=linux/arm64'
|
|
13
19
|
- '--network=cloudbuild'
|
|
14
20
|
- '-t'
|
|
15
21
|
- '{{imageName}}:{{imageVersion}}'
|