@rlyle1179/serverless-aws-batch 1.0.46 → 1.0.49
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/lib/docker.js +14 -12
- package/lib/ecr.js +1 -2
- package/package.json +1 -1
package/lib/docker.js
CHANGED
|
@@ -6,7 +6,7 @@ const path = require('path');
|
|
|
6
6
|
const util = require('util');
|
|
7
7
|
const { getDockerLoginToECRCommand } = require('./awscli');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const DOCKER_TAG = `${Date.now()}`;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @returns {string} "<ECR Repo Name>:latest"
|
|
@@ -33,7 +33,7 @@ function dockerCommand(options, cwd = null, stdio = null) {
|
|
|
33
33
|
spawnOptions.stdio = stdio;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
console.error("dockerCommand:", options, spawnOptions);
|
|
36
|
+
//console.error("dockerCommand:", options, spawnOptions);
|
|
37
37
|
const ps = spawnSync(cmd, options, spawnOptions);
|
|
38
38
|
if (ps.error) {
|
|
39
39
|
if (ps.error.code === 'ENOENT') {
|
|
@@ -41,9 +41,9 @@ function dockerCommand(options, cwd = null, stdio = null) {
|
|
|
41
41
|
}
|
|
42
42
|
throw new Error(ps.error);
|
|
43
43
|
} else if (ps.status !== 0) {
|
|
44
|
-
console.error("docker output:", ps.output);
|
|
45
|
-
console.error("docker stdout:", ps.stdout);
|
|
46
|
-
console.error("docker stderr:", ps.stderr)
|
|
44
|
+
//console.error("docker output:", ps.output);
|
|
45
|
+
//console.error("docker stdout:", ps.stdout);
|
|
46
|
+
//console.error("docker stderr:", ps.stderr)
|
|
47
47
|
throw new Error(ps.stderr);
|
|
48
48
|
}
|
|
49
49
|
return ps;
|
|
@@ -91,12 +91,14 @@ function buildDockerImage() {
|
|
|
91
91
|
WORKDIR /var/task/${this.serverless.service.service}/
|
|
92
92
|
`;
|
|
93
93
|
// custom ENTRYPOINT due to heap setting - entrypoint copied from original
|
|
94
|
-
if (this.serverless.service.provider.runtime === 'nodejs8.10')
|
|
95
|
-
'ENTRYPOINT ["/var/lang/bin/node", "--expose-gc", "--max-semi-space-size=150", "--max-old-space-size=30000", "/var/runtime/node_modules/awslambda/index.js"]\n'
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
if (this.serverless.service.provider.runtime === 'nodejs8.10') {
|
|
95
|
+
dockerFileContents.concat('ENTRYPOINT ["/var/lang/bin/node", "--expose-gc", "--max-semi-space-size=150", "--max-old-space-size=30000", "/var/runtime/node_modules/awslambda/index.js"]\n');
|
|
96
|
+
} else if (this.serverless.service.provider.runtime === 'nodejs10.x') {
|
|
97
|
+
dockerFileContents.concat('ENV NODE_OPTIONS="--max-old-space-size=30000"\n');
|
|
98
|
+
} else {
|
|
99
|
+
dockerFileContents.concat('ENV NODE_OPTIONS="--max-old-space-size=30000"\n');
|
|
100
|
+
}
|
|
101
|
+
|
|
100
102
|
const servicePath = this.serverless.config.servicePath || '';
|
|
101
103
|
const packagePath = path.join(servicePath || '.', '.serverless');
|
|
102
104
|
const dockerFile = path.join(packagePath, 'Dockerfile');
|
|
@@ -119,7 +121,7 @@ function pushDockerImageToECR() {
|
|
|
119
121
|
|
|
120
122
|
// Then perform the upload
|
|
121
123
|
this.serverless.cli.log("Uploading to ECR...");
|
|
122
|
-
dockerCommand(['push', this.provider.naming.getECRRepositoryURL()], null, 'inherit');
|
|
124
|
+
dockerCommand(['push', '--all-tags', this.provider.naming.getECRRepositoryURL()], null, 'inherit');
|
|
123
125
|
|
|
124
126
|
return BbPromise.resolve();
|
|
125
127
|
}
|
package/lib/ecr.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const { getAWSAccountID } = require('./awscli');
|
|
2
|
-
import { DOCKER_TAG } from './docker';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* @returns {string} "ECRRepository"
|
|
@@ -21,7 +20,7 @@ function getECRRepositoryName() {
|
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
function getECRRepositoryURL() {
|
|
24
|
-
return `${getAWSAccountID()}.dkr.ecr.${this.provider.getRegion()}.amazonaws.com/${this.provider.naming.getECRRepositoryName()}
|
|
23
|
+
return `${getAWSAccountID()}.dkr.ecr.${this.provider.getRegion()}.amazonaws.com/${this.provider.naming.getECRRepositoryName()}`
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
module.exports = {
|