Skip to content

Commit 604cab3

Browse files
use relative paths for Docker
1 parent 885dd0b commit 604cab3

File tree

7 files changed

+12
-7
lines changed

7 files changed

+12
-7
lines changed

examples/self-hosted/local-postgres/powersync/docker/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
include:
77
[
8-
/Users/stevenontong/Documents/platform_code/powersync/new-cli/examples/self-hosted/docker/powersync/docker/modules/database-postgres/postgres.database.compose.yaml,
9-
/Users/stevenontong/Documents/platform_code/powersync/new-cli/examples/self-hosted/docker/powersync/docker/modules/storage-postgres/postgres.storage.compose.yaml
8+
modules/database-postgres/postgres.database.compose.yaml,
9+
modules/storage-postgres/postgres.storage.compose.yaml
1010
]
1111

1212
services:

examples/self-hosted/local-postgres/powersync/link.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ api_url: http://localhost:8080
88
api_key: dev-token-do-not-use-in-production
99
plugins:
1010
docker:
11-
project_name: powersync_docker
11+
project_name: powersync_local-postgres

plugins/docker/src/commands/docker/configure.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default class DockerConfigure extends SelfHostedInstanceCommand {
8787
const moduleContext: DockerModuleContext = {
8888
command: this,
8989
projectdirectory: projectDirectory,
90+
composeOutputDirectory: targetDockerDir,
9091
modulesOutputDirectory: modulesDir,
9192
mainComposeDocument,
9293
serviceConfig: serviceConfigDocument

plugins/docker/src/commands/docker/start.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ux } from '@oclif/core';
2-
import { SelfHostedInstanceCommand, type SelfHostedInstanceCommandFlags } from '@powersync/cli-core';
2+
import { SelfHostedInstanceCommand } from '@powersync/cli-core';
33
import { getDockerProjectName, logPowersyncProjectsStopHelp, runDockerCompose } from '../../docker.js';
44

55
export default class DockerStart extends SelfHostedInstanceCommand {
@@ -13,7 +13,7 @@ export default class DockerStart extends SelfHostedInstanceCommand {
1313

1414
async run(): Promise<void> {
1515
const { flags } = await this.parse(DockerStart);
16-
const { projectDirectory } = this.loadProject(flags as SelfHostedInstanceCommandFlags, {
16+
const { projectDirectory } = this.loadProject(flags, {
1717
configFileRequired: false,
1818
linkingIsRequired: false
1919
});

plugins/docker/src/templates/bucket-storage/postgres/PostgresBucketStorageModule.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const PostgresBucketStorageModule: DockerModule = {
2727
fs.cpSync(initScriptsSrc, initScriptsDest, { recursive: true });
2828
}
2929

30-
(mainComposeDocument.get('include') as YAMLSeq).add(storageComposeFilePath);
30+
const includePath = path.relative(context.composeOutputDirectory, storageComposeFilePath);
31+
(mainComposeDocument.get('include') as YAMLSeq).add(includePath);
3132

3233
const servicesNode = mainComposeDocument.get('services');
3334
if (isMap(servicesNode)) {

plugins/docker/src/templates/source-database/postgres/PostgresSourceDatabaseModule.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const PostgresSourceDatabaseModule: DockerModule = {
4343
fs.cpSync(initScriptsSrc, initScriptsDest, { recursive: true });
4444
}
4545

46-
(mainComposeDocument.get('include') as YAMLSeq).add(databaseComposeFilePath);
46+
const includePath = path.relative(context.composeOutputDirectory, databaseComposeFilePath);
47+
(mainComposeDocument.get('include') as YAMLSeq).add(includePath);
4748

4849
const servicesNode = mainComposeDocument.get('services');
4950
if (isMap(servicesNode)) {

plugins/docker/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type DockerModuleContext = {
1111
/** Invoking command, for logging and output. */
1212
command: Command;
1313
projectdirectory: string;
14+
/** Directory containing docker-compose.yaml (powersync/docker/). Used for relative include paths. */
15+
composeOutputDirectory: string;
1416
modulesOutputDirectory: string;
1517
/** Main docker-compose document (docker/). Modules may add to include and services.powersync.depends_on. */
1618
mainComposeDocument: Document;

0 commit comments

Comments
 (0)