Skip to content

Commit

Permalink
fix: docker cluster site distribution functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsdaniels committed Sep 2, 2024
1 parent 11f62f4 commit 315085a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-rice-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codedazur/cdk-site-distribution": patch
---

The SiteDistribution's functions attribute was made public.
5 changes: 5 additions & 0 deletions .changeset/hot-bags-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codedazur/cdk-docker-cluster": patch
---

The DockerCluster's site distribution attribute was renamed.
8 changes: 5 additions & 3 deletions packages/cdk-docker-cluster/src/constructs/DockerCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class DockerCluster extends Construct {
public readonly domain?: string;
public readonly image: ContainerImage;
public readonly service: ApplicationLoadBalancedFargateService;
public readonly distribution: SiteDistribution;
public readonly siteDistribution: SiteDistribution;

constructor(
scope: Construct,
Expand All @@ -72,13 +72,15 @@ export class DockerCluster extends Construct {
: this.createImage(this.props.source);

this.service = this.createService();
this.distribution = this.createDistribution();
this.siteDistribution = this.createSiteDistribution();
}

protected createImage(source: string | SourceProps) {
const props: Partial<AssetImageProps> = {
exclude: [`**/${this.getOutputDirectory()}`],
platform: Platform.LINUX_AMD64,
// networkMode: NetworkMode.HOST, // @todo Use the host network mode.
// cacheFrom: [], // @todo Use the previously built image as a cache.
};

if (typeof source === "string") {
Expand Down Expand Up @@ -126,7 +128,7 @@ export class DockerCluster extends Construct {
return service;
}

protected createDistribution() {
protected createSiteDistribution() {
return new SiteDistribution(this, "Distribution", {
allowedMethods: AllowedMethods.ALLOW_ALL,
cachePolicy: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ export class SiteDistribution extends Construct {
public readonly zone?: IHostedZone;
public readonly certificate?: ICertificate;
public readonly distribution: Distribution;
public readonly functions: CloudFrontFunction[] = [];
public readonly alias?: ARecord;
public readonly cacheInvalidator?: CacheInvalidator;

private readonly functions: CloudFrontFunction[] = [];

constructor(
scope: Construct,
id: string,
Expand Down

0 comments on commit 315085a

Please sign in to comment.