@rlyle1179/serverless-aws-batch 1.0.31 → 1.0.34

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 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()}:latest`;
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
- this.serverless.cli.log(`Building docker image: "${this.provider.naming.getDockerImageName()}"...`);
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', this.provider.naming.getDockerImageName(), '.'];
101
+ const dockerOptions = ['build', '-f', dockerFile, '-t', image, '.'];
99
102
  dockerCommand(dockerOptions, packagePath, 'inherit');
100
103
 
101
104
  return BbPromise.resolve();
@@ -7,6 +7,24 @@ const path = require('path');
7
7
  const _ = require('lodash');
8
8
  var util = require('util');
9
9
 
10
+ const expireRule = {
11
+ "rules": [
12
+ {
13
+ "rulePriority": 1,
14
+ "description": "Remove images over 90 days old",
15
+ "selection": {
16
+ "tagStatus": "any",
17
+ "countType": "sinceImagePushed",
18
+ "countUnit": "days",
19
+ "countNumber": 90
20
+ },
21
+ "action": {
22
+ "type": "expire"
23
+ }
24
+ }
25
+ ]
26
+ };
27
+
10
28
  /**
11
29
  * Adds the ECR repository to the "create" template so that we have a repository we can upload our docker image to
12
30
  * during deployment.
@@ -18,7 +36,7 @@ function generateCoreTemplate() {
18
36
  "Type" : "AWS::ECR::Repository",
19
37
  "Properties" : {
20
38
  "LifecyclePolicy" : {
21
- "LifecyclePolicyText" : "{\\"rules\\":[{\\"rulePriority\\":1,\\"description\\":\\"Remove untagged images\\",\\"selection\\":{\\"tagStatus\\":\\"untagged\\",\\"countType\\":\\"sinceImagePushed\\",\\"countUnit\\":\\"days\\",\\"countNumber\\":1},\\"action\\":{\\"type\\":\\"expire\\"}}]}"
39
+ "LifecyclePolicyText" : ${JSON.stringify(expireRule)}
22
40
  },
23
41
  "RepositoryName" : "${this.provider.naming.getECRRepositoryName()}"
24
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rlyle1179/serverless-aws-batch",
3
- "version": "1.0.31",
3
+ "version": "1.0.34",
4
4
  "description": "Serverless Framework Plugin for interacting with AWS Batch",
5
5
  "main": "index.js",
6
6
  "scripts": {