@rlyle1179/serverless-aws-batch 1.0.30 → 1.0.33
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/index.js +0 -4
- package/lib/docker.js +6 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -51,10 +51,6 @@ class ServerlessAWSBatch {
|
|
|
51
51
|
.then(batchenvironment.generateAWSBatchTemplate)
|
|
52
52
|
.then(batchtask.compileBatchTasks),
|
|
53
53
|
|
|
54
|
-
'after:aws:common:moveArtifactsToPackage:move': () => BbPromise.bind(this)
|
|
55
|
-
.then((e) => {
|
|
56
|
-
console.log("after:aws:common:moveArtifactsToPackage:move:", e );
|
|
57
|
-
}),
|
|
58
54
|
'after:package:createDeploymentArtifacts': () => BbPromise.bind(this)
|
|
59
55
|
.then(docker.buildDockerImage),
|
|
60
56
|
|
package/lib/docker.js
CHANGED
|
@@ -6,11 +6,13 @@ const path = require('path');
|
|
|
6
6
|
const util = require('util');
|
|
7
7
|
const { getDockerLoginToECRCommand } = require('./awscli');
|
|
8
8
|
|
|
9
|
+
const DOCKER_TAG = Date.now();
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* @returns {string} "<ECR Repo Name>:latest"
|
|
11
13
|
*/
|
|
12
14
|
function getDockerImageName() {
|
|
13
|
-
return `${this.provider.naming.getECRRepositoryURL()}
|
|
15
|
+
return `${this.provider.naming.getECRRepositoryURL()}:${DOCKER_TAG}`;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -51,7 +53,8 @@ function dockerCommand(options, cwd = null, stdio = null) {
|
|
|
51
53
|
* https://hub.docker.com/r/lambci/lambda/
|
|
52
54
|
*/
|
|
53
55
|
function buildDockerImage() {
|
|
54
|
-
|
|
56
|
+
let image = this.provider.naming.getDockerImageName();
|
|
57
|
+
this.serverless.cli.log(`Building docker image: "${image}"...`);
|
|
55
58
|
|
|
56
59
|
// Get any additional run commands we'd like to include in the docker image
|
|
57
60
|
let additionalRunCommands = "";
|
|
@@ -95,7 +98,7 @@ function buildDockerImage() {
|
|
|
95
98
|
const dockerFile = path.join(packagePath, 'Dockerfile');
|
|
96
99
|
fse.writeFileSync(dockerFile, dockerFileContents);
|
|
97
100
|
|
|
98
|
-
const dockerOptions = ['build', '-f', dockerFile, '-t',
|
|
101
|
+
const dockerOptions = ['build', '-f', dockerFile, '-t', image, '.'];
|
|
99
102
|
dockerCommand(dockerOptions, packagePath, 'inherit');
|
|
100
103
|
|
|
101
104
|
return BbPromise.resolve();
|