diff --git a/build.py b/build.py index a1d4dc36..2dc67d60 100644 --- a/build.py +++ b/build.py @@ -11,8 +11,7 @@ args = [ "--paths", site_packages_dir, "--add-data", - f"{llama_cpp_dir}{os.pathsep}llama_cpp", - "--onefile" + f"{llama_cpp_dir}{os.pathsep}llama_cpp" ] # generate the .spec file and run PyInstaller diff --git a/desktop/README.md b/desktop/README.md index 1dabab51..b9cbda50 100644 --- a/desktop/README.md +++ b/desktop/README.md @@ -1,6 +1,6 @@ # Desktop -The Ollama desktop app +The Ollama desktop experience ## Running diff --git a/desktop/forge.config.ts b/desktop/forge.config.ts index 61900f1e..f9342d2e 100644 --- a/desktop/forge.config.ts +++ b/desktop/forge.config.ts @@ -3,6 +3,7 @@ import { MakerSquirrel } from '@electron-forge/maker-squirrel' import { MakerZIP } from '@electron-forge/maker-zip' import { MakerDeb } from '@electron-forge/maker-deb' import { MakerRpm } from '@electron-forge/maker-rpm' +import { PublisherGithub } from '@electron-forge/publisher-github' import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives' import { WebpackPlugin } from '@electron-forge/plugin-webpack' @@ -14,9 +15,32 @@ const config: ForgeConfig = { asar: true, icon: './images/icon', extraResource: ['../dist/ollama'], + ...(process.env.SIGN + ? { + osxSign: { + identity: process.env.APPLE_IDENTITY, + }, + osxNotarize: { + tool: 'notarytool', + appleId: process.env.APPLE_ID || '', + appleIdPassword: process.env.APPLE_PASSWORD || '', + teamId: process.env.APPLE_TEAM_ID || '', + }, + } + : {}), }, rebuildConfig: {}, makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})], + publishers: [ + new PublisherGithub({ + repository: { + name: 'ollama', + owner: 'jmorganca', + }, + draft: false, + prerelease: true, + }), + ], plugins: [ new AutoUnpackNativesPlugin({}), new WebpackPlugin({ diff --git a/desktop/images/icon.icns b/desktop/images/icon.icns index ad9a1819..e4c55199 100644 Binary files a/desktop/images/icon.icns and b/desktop/images/icon.icns differ diff --git a/desktop/package-lock.json b/desktop/package-lock.json index da3377b8..90a8dfa5 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -25,6 +25,7 @@ "@electron-forge/maker-zip": "^6.2.1", "@electron-forge/plugin-auto-unpack-natives": "^6.2.1", "@electron-forge/plugin-webpack": "^6.2.1", + "@electron-forge/publisher-github": "^6.2.1", "@types/chmodr": "^1.0.0", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.6", @@ -1580,6 +1581,26 @@ "node": ">= 14.17.5" } }, + "node_modules/@electron-forge/publisher-github": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/publisher-github/-/publisher-github-6.2.1.tgz", + "integrity": "sha512-EqSZfELavDkshjtYYM9U7oWBtGB7Dj9bWEHzCkJKwemCr1IiWKtB8FKcVildPwu4UnOad21k+nGHRdxyniky+w==", + "dev": true, + "dependencies": { + "@electron-forge/publisher-base": "6.2.1", + "@electron-forge/shared-types": "6.2.1", + "@octokit/core": "^3.2.4", + "@octokit/plugin-retry": "^3.0.9", + "@octokit/rest": "^18.0.11", + "@octokit/types": "^6.1.2", + "debug": "^4.3.1", + "fs-extra": "^10.0.0", + "mime-types": "^2.1.25" + }, + "engines": { + "node": ">= 14.17.5" + } + }, "node_modules/@electron-forge/shared-types": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-6.2.1.tgz", @@ -2206,6 +2227,166 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/@octokit/auth-token": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", + "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", + "dev": true, + "dependencies": { + "@octokit/types": "^6.0.3" + } + }, + "node_modules/@octokit/core": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz", + "integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==", + "dev": true, + "dependencies": { + "@octokit/auth-token": "^2.4.4", + "@octokit/graphql": "^4.5.8", + "@octokit/request": "^5.6.3", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.0.3", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/endpoint": { + "version": "6.0.12", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", + "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", + "dev": true, + "dependencies": { + "@octokit/types": "^6.0.3", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/endpoint/node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@octokit/graphql": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", + "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", + "dev": true, + "dependencies": { + "@octokit/request": "^5.6.0", + "@octokit/types": "^6.0.3", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "12.11.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", + "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==", + "dev": true + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "2.21.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz", + "integrity": "sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==", + "dev": true, + "dependencies": { + "@octokit/types": "^6.40.0" + }, + "peerDependencies": { + "@octokit/core": ">=2" + } + }, + "node_modules/@octokit/plugin-request-log": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz", + "integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==", + "dev": true, + "peerDependencies": { + "@octokit/core": ">=3" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", + "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", + "dev": true, + "dependencies": { + "@octokit/types": "^6.39.0", + "deprecation": "^2.3.1" + }, + "peerDependencies": { + "@octokit/core": ">=3" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz", + "integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^6.0.3", + "bottleneck": "^2.15.3" + } + }, + "node_modules/@octokit/request": { + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", + "integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", + "dev": true, + "dependencies": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.1.0", + "@octokit/types": "^6.16.1", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.7", + "universal-user-agent": "^6.0.0" + } + }, + "node_modules/@octokit/request-error": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", + "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", + "dev": true, + "dependencies": { + "@octokit/types": "^6.0.3", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "node_modules/@octokit/request/node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@octokit/rest": { + "version": "18.12.0", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.12.0.tgz", + "integrity": "sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q==", + "dev": true, + "dependencies": { + "@octokit/core": "^3.5.1", + "@octokit/plugin-paginate-rest": "^2.16.8", + "@octokit/plugin-request-log": "^1.0.4", + "@octokit/plugin-rest-endpoint-methods": "^5.12.0" + } + }, + "node_modules/@octokit/types": { + "version": "6.41.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz", + "integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^12.11.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -3544,6 +3725,12 @@ "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", "dev": true }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true + }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -3648,6 +3835,12 @@ "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", "optional": true }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4801,6 +4994,12 @@ "node": ">= 0.8" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true + }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", @@ -12570,6 +12769,12 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==", + "dev": true + }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", diff --git a/desktop/package.json b/desktop/package.json index 96227ae4..feaf0594 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -7,8 +7,10 @@ "scripts": { "start": "electron-forge start", "package": "electron-forge package", + "package:sign": "SIGN=1 electron-forge package", "make": "electron-forge make", - "publish": "electron-forge publish", + "make:sign": "SIGN=1 electron-forge package", + "publish": "SIGN=1 electron-forge publish", "lint": "eslint --ext .ts,.tsx ." }, "keywords": [], @@ -27,6 +29,7 @@ "@electron-forge/maker-zip": "^6.2.1", "@electron-forge/plugin-auto-unpack-natives": "^6.2.1", "@electron-forge/plugin-webpack": "^6.2.1", + "@electron-forge/publisher-github": "^6.2.1", "@types/chmodr": "^1.0.0", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.6", diff --git a/desktop/src/index.ts b/desktop/src/index.ts index 5c2b83ae..57de8a16 100644 --- a/desktop/src/index.ts +++ b/desktop/src/index.ts @@ -43,9 +43,9 @@ if (app.isPackaged) { console.log(resources) // Start the executable - const exec = path.join(resources, 'serve', '--port', '7734') + const exec = path.join(resources, 'ollama', 'ollama') console.log(`Starting ${exec}`) - const proc = spawn(exec) + const proc = spawn(exec, ['serve', '--port', '7734']) proc.stdout.on('data', data => { console.log(`server: ${data}`) })