@codedazur/cdk-docker-cluster 0.3.0 → 0.4.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @codedazur/cdk-docker-cluster
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`17d19aea004254b214364caef8fa02f9a6019f8f`](https://github.com/codedazur/toolkit/commit/17d19aea004254b214364caef8fa02f9a6019f8f) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Buildtime and runtime environment variables are now supported.
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -4,11 +4,12 @@ This construct creates a load balanced Fargate service, for which it builds a Do
4
4
 
5
5
  ```ts
6
6
  new DockerCluster({
7
- path: "../my/directory", // Must contain a Dockerfile.
7
+ path: "../../", // path to Docker build context
8
+ file: "apps/myApp/DockerFile", // path to Dockerfile
8
9
  port: 3000,
9
- cpu: 256,
10
- memory: 512,
11
- instances: 1,
10
+ cpu: 1024, // 1vCPU
11
+ memory: 4096, // 4GB
12
+ tasks: { minimum: 1, maximum: 10 },
12
13
  secrets: {
13
14
  foo: DockerBuildSecret.fromSrc("./foo"),
14
15
  },
package/dist/index.d.mts CHANGED
@@ -12,6 +12,10 @@ interface DockerClusterProps {
12
12
  };
13
13
  cpu?: ApplicationLoadBalancedFargateServiceProps["cpu"];
14
14
  memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
15
+ environment?: {
16
+ buildtime?: Record<string, string>;
17
+ runtime?: Record<string, string>;
18
+ };
15
19
  }
16
20
  /**
17
21
  * An Docker cluster on a load balanced Fargate service on EC2, using an image
package/dist/index.d.ts CHANGED
@@ -12,6 +12,10 @@ interface DockerClusterProps {
12
12
  };
13
13
  cpu?: ApplicationLoadBalancedFargateServiceProps["cpu"];
14
14
  memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
15
+ environment?: {
16
+ buildtime?: Record<string, string>;
17
+ runtime?: Record<string, string>;
18
+ };
15
19
  }
16
20
  /**
17
21
  * An Docker cluster on a load balanced Fargate service on EC2, using an image
package/dist/index.js CHANGED
@@ -34,16 +34,17 @@ var import_aws_ecs_patterns = require("aws-cdk-lib/aws-ecs-patterns");
34
34
  var import_constructs = require("constructs");
35
35
  var DockerCluster = class extends import_constructs.Construct {
36
36
  constructor(scope, id, props) {
37
- var _a;
37
+ var _a, _b, _c;
38
38
  super(scope, id);
39
39
  const image = new import_aws_ecr_assets.DockerImageAsset(this, "Image", {
40
40
  directory: props.path,
41
41
  file: props.file,
42
42
  exclude: ["**/cdk.out"],
43
43
  buildSecrets: props.secrets,
44
- platform: import_aws_ecr_assets.Platform.LINUX_AMD64
44
+ platform: import_aws_ecr_assets.Platform.LINUX_AMD64,
45
+ buildArgs: (_a = props.environment) == null ? void 0 : _a.buildtime
45
46
  });
46
- const desiredTasks = typeof props.tasks === "number" ? props.tasks : (_a = props.tasks) == null ? void 0 : _a.minimum;
47
+ const desiredTasks = typeof props.tasks === "number" ? props.tasks : (_b = props.tasks) == null ? void 0 : _b.minimum;
47
48
  const fargate = new import_aws_ecs_patterns.ApplicationLoadBalancedFargateService(this, "Service", {
48
49
  cluster: new import_aws_ecs.Cluster(this, "Cluster"),
49
50
  cpu: props.cpu,
@@ -52,7 +53,8 @@ var DockerCluster = class extends import_constructs.Construct {
52
53
  taskImageOptions: {
53
54
  // image: ContainerImage.fromEcrRepository(image.repository, image.imageTag),
54
55
  image: import_aws_ecs.ContainerImage.fromDockerImageAsset(image),
55
- containerPort: props.port
56
+ containerPort: props.port,
57
+ environment: (_c = props.environment) == null ? void 0 : _c.runtime
56
58
  },
57
59
  circuitBreaker: {
58
60
  enable: true,
package/dist/index.mjs CHANGED
@@ -10,16 +10,17 @@ import {
10
10
  import { Construct } from "constructs";
11
11
  var DockerCluster = class extends Construct {
12
12
  constructor(scope, id, props) {
13
- var _a;
13
+ var _a, _b, _c;
14
14
  super(scope, id);
15
15
  const image = new DockerImageAsset(this, "Image", {
16
16
  directory: props.path,
17
17
  file: props.file,
18
18
  exclude: ["**/cdk.out"],
19
19
  buildSecrets: props.secrets,
20
- platform: Platform.LINUX_AMD64
20
+ platform: Platform.LINUX_AMD64,
21
+ buildArgs: (_a = props.environment) == null ? void 0 : _a.buildtime
21
22
  });
22
- const desiredTasks = typeof props.tasks === "number" ? props.tasks : (_a = props.tasks) == null ? void 0 : _a.minimum;
23
+ const desiredTasks = typeof props.tasks === "number" ? props.tasks : (_b = props.tasks) == null ? void 0 : _b.minimum;
23
24
  const fargate = new ApplicationLoadBalancedFargateService(this, "Service", {
24
25
  cluster: new Cluster(this, "Cluster"),
25
26
  cpu: props.cpu,
@@ -28,7 +29,8 @@ var DockerCluster = class extends Construct {
28
29
  taskImageOptions: {
29
30
  // image: ContainerImage.fromEcrRepository(image.repository, image.imageTag),
30
31
  image: ContainerImage.fromDockerImageAsset(image),
31
- containerPort: props.port
32
+ containerPort: props.port,
33
+ environment: (_c = props.environment) == null ? void 0 : _c.runtime
32
34
  },
33
35
  circuitBreaker: {
34
36
  enable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codedazur/cdk-docker-cluster",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "main": ".dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",