@rlyle1179/serverless-aws-batch 1.0.32 → 1.0.35
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 +3 -1
- package/lib/generateCoreTemplate.js +19 -1
- package/package.json +1 -1
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
|
/**
|
|
@@ -7,6 +7,24 @@ const path = require('path');
|
|
|
7
7
|
const _ = require('lodash');
|
|
8
8
|
var util = require('util');
|
|
9
9
|
|
|
10
|
+
const lifeCyclePolicies = {
|
|
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" : "{
|
|
39
|
+
"LifecyclePolicyText" : "${JSON.stringify(lifeCyclePolicies)}"
|
|
22
40
|
},
|
|
23
41
|
"RepositoryName" : "${this.provider.naming.getECRRepositoryName()}"
|
|
24
42
|
}
|