back to cdk style
Build and push Docker image / build (push) Successful in 9s
Details
Build and push Docker image / build (push) Successful in 9s
Details
This commit is contained in:
parent
a0cfb72340
commit
334b38c5f8
|
@ -22,7 +22,7 @@ export class RedisStack extends Stack {
|
|||
constructor(props: ImmichStackOptions) {
|
||||
super(props.stackName ?? "immich");
|
||||
|
||||
const redis = this.addService("redis", {
|
||||
const redis = new Service(this, "redis", {
|
||||
image: `registry.hub.docker.com/library/redis:${props.redisVersion ?? "alpine"}`,
|
||||
restart: "unless-stopped"
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* https://raw.githubusercontent.com/immich-app/immich/main/docker/docker-compose.yml
|
||||
*/
|
||||
|
||||
import { ComposeStack } from "../mod.ts";
|
||||
import { ComposeStack, Service } from "../mod.ts";
|
||||
|
||||
interface ImmichStackOptions {
|
||||
stackName?: string;
|
||||
|
@ -20,7 +20,7 @@ export class ImmichStack extends ComposeStack {
|
|||
constructor(props: ImmichStackOptions) {
|
||||
super(props.stackName ?? "immich");
|
||||
|
||||
const redis = this.addService("redis", {
|
||||
const redis = new Service(this, "redis", {
|
||||
image: "registry.hub.docker.com/library/redis:6.2-alpine",
|
||||
restart: "unless-stopped",
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ export class ImmichStack extends ComposeStack {
|
|||
database: "postgres",
|
||||
};
|
||||
|
||||
const database = this.addService("database", {
|
||||
const database = new Service(this, "database", {
|
||||
image: "registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0",
|
||||
restart: "unless-stopped",
|
||||
environment: {
|
||||
|
@ -51,7 +51,7 @@ export class ImmichStack extends ComposeStack {
|
|||
REDIS_HOSTNAME: redis.name,
|
||||
};
|
||||
|
||||
const _immichServer = this.addService("immich-server", {
|
||||
const _immichServer = new Service(this, "immich-server", {
|
||||
image: `ghcr.io/immich-app/immich-server:${
|
||||
props.immichVersion ?? "release"
|
||||
}`,
|
||||
|
@ -63,7 +63,7 @@ export class ImmichStack extends ComposeStack {
|
|||
ports: ["2283:3001"],
|
||||
});
|
||||
|
||||
const _immichMicroservices = this.addService("immich-microservices", {
|
||||
const _immichMicroservices = new Service(this, "immich-microservices", {
|
||||
image: `ghcr.io/immich-app/immich-server:${
|
||||
props.immichVersion ?? "release"
|
||||
}`,
|
||||
|
@ -74,13 +74,17 @@ export class ImmichStack extends ComposeStack {
|
|||
environment: immichEnv,
|
||||
});
|
||||
|
||||
const _immichMachineLearning = this.addService("immich-machine-learning", {
|
||||
image: `ghcr.io/immich-app/immich-machine-learning:${
|
||||
props.immichVersion ?? "release"
|
||||
}`,
|
||||
// todo volumes
|
||||
environment: immichEnv,
|
||||
});
|
||||
const _immichMachineLearning = new Service(
|
||||
this,
|
||||
"immich-machine-learning",
|
||||
{
|
||||
image: `ghcr.io/immich-app/immich-machine-learning:${
|
||||
props.immichVersion ?? "release"
|
||||
}`,
|
||||
// todo volumes
|
||||
environment: immichEnv,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import { DefinitionsNetwork } from "../compose-schema.ts";
|
||||
import { ComposeStack } from "./stack.ts";
|
||||
|
||||
export class Network {
|
||||
constructor(
|
||||
public readonly stack: ComposeStack,
|
||||
public readonly name: string,
|
||||
public options: DefinitionsNetwork
|
||||
) {}
|
||||
) {
|
||||
this.stack.addNetwork(this);
|
||||
}
|
||||
|
||||
toCompose(): DefinitionsNetwork {
|
||||
return this.options;
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import { DefinitionsService } from "../compose-schema.ts";
|
||||
import { ComposeStack } from "./stack.ts";
|
||||
|
||||
export class Service {
|
||||
constructor(
|
||||
public readonly stack: ComposeStack,
|
||||
public readonly name: string,
|
||||
public options: DefinitionsService
|
||||
) {}
|
||||
) {
|
||||
this.stack.addService(this);
|
||||
}
|
||||
|
||||
toCompose(): DefinitionsService {
|
||||
return this.options;
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
ComposeSpecification,
|
||||
DefinitionsNetwork,
|
||||
DefinitionsService,
|
||||
DefinitionsVolume,
|
||||
} from "../compose-schema.ts";
|
||||
import { ComposeSpecification } from "../compose-schema.ts";
|
||||
import { registerDeployment } from "../deployment.ts";
|
||||
import { Network } from "./network.ts";
|
||||
import { Service } from "./service.ts";
|
||||
|
@ -50,51 +45,36 @@ export class ComposeStack {
|
|||
registerDeployment(this);
|
||||
}
|
||||
|
||||
public addService(
|
||||
name: string,
|
||||
service: Service | DefinitionsService
|
||||
): Service {
|
||||
public addService(service: Service): Service {
|
||||
const name = service.name;
|
||||
|
||||
if (this.services[name]) {
|
||||
throw new Error(`Service ${name} already defined.`);
|
||||
}
|
||||
|
||||
if (service instanceof Service) {
|
||||
this.services[name] = service;
|
||||
} else {
|
||||
this.services[name] = new Service(name, service);
|
||||
}
|
||||
|
||||
this.services[name] = service;
|
||||
return this.services[name];
|
||||
}
|
||||
|
||||
public addNetwork(
|
||||
name: string,
|
||||
network: Network | DefinitionsNetwork
|
||||
): Network {
|
||||
public addNetwork(network: Network): Network {
|
||||
const name = network.name;
|
||||
|
||||
if (this.networks[name]) {
|
||||
throw new Error(`Network ${name} already defined.`);
|
||||
}
|
||||
|
||||
if (network instanceof Network) {
|
||||
this.networks[name] = network;
|
||||
} else {
|
||||
this.networks[name] = new Network(name, network);
|
||||
}
|
||||
|
||||
this.networks[name] = network;
|
||||
return this.networks[name];
|
||||
}
|
||||
|
||||
public addVolume(name: string, volume: Volume | DefinitionsVolume): Volume {
|
||||
public addVolume(volume: Volume): Volume {
|
||||
const name = volume.name;
|
||||
|
||||
if (this.volumes[name]) {
|
||||
throw new Error(`Volume ${name} already defined.`);
|
||||
}
|
||||
|
||||
if (volume instanceof Volume) {
|
||||
this.volumes[name] = volume;
|
||||
} else {
|
||||
this.volumes[name] = new Volume(name, volume);
|
||||
}
|
||||
|
||||
this.volumes[name] = volume;
|
||||
return this.volumes[name];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import { DefinitionsVolume } from "../compose-schema.ts";
|
||||
import { ComposeStack } from "./stack.ts";
|
||||
|
||||
export class Volume {
|
||||
constructor(
|
||||
public readonly stack: ComposeStack,
|
||||
public readonly name: string,
|
||||
public options: DefinitionsVolume
|
||||
) {}
|
||||
) {
|
||||
this.stack.addVolume(this);
|
||||
}
|
||||
|
||||
toCompose(): DefinitionsVolume {
|
||||
return this.options;
|
||||
|
|
Loading…
Reference in New Issue