diff --git a/.changeset/tidy-poems-tickle.md b/.changeset/tidy-poems-tickle.md new file mode 100644 index 00000000000..1d8f953c0fc --- /dev/null +++ b/.changeset/tidy-poems-tickle.md @@ -0,0 +1,5 @@ +--- +'@keystone-next/keystone': patch +--- + +Changed symlink generation to use relative path instead of absolute. Solves running project in docker when mapping volume. diff --git a/packages/keystone/src/admin-ui/system/generateAdminUI.ts b/packages/keystone/src/admin-ui/system/generateAdminUI.ts index 250a48e1249..5b2e259909b 100644 --- a/packages/keystone/src/admin-ui/system/generateAdminUI.ts +++ b/packages/keystone/src/admin-ui/system/generateAdminUI.ts @@ -61,13 +61,21 @@ export const generateAdminUI = async ( if (config.images) { const storagePath = Path.resolve(config.images.local?.storagePath ?? './public/images'); await fs.mkdir(storagePath, { recursive: true }); - await fs.symlink(storagePath, Path.join(publicDirectory, 'images'), 'junction'); + await fs.symlink( + Path.relative(publicDirectory, storagePath), + Path.join(publicDirectory, 'images'), + 'junction' + ); } if (config.files) { const storagePath = Path.resolve(config.files.local?.storagePath ?? './public/files'); await fs.mkdir(storagePath, { recursive: true }); - await fs.symlink(storagePath, Path.join(publicDirectory, 'files'), 'junction'); + await fs.symlink( + Path.relative(publicDirectory, storagePath), + Path.join(publicDirectory, 'files'), + 'junction' + ); } // Write out the files configured by the user