fix: Dockerfile

This commit is contained in:
WJG 2024-02-29 14:29:41 +08:00
parent bf7bdf4473
commit 5441c98841
No known key found for this signature in database
GPG Key ID: 258474EF8590014A
4 changed files with 31 additions and 10 deletions

View File

@ -31,6 +31,7 @@
**/build
**/dist
LICENSE
TODO.md
README.md
**/.bot.json
**/.mi.json

View File

@ -40,6 +40,8 @@ RUN --mount=type=bind,source=package.json,target=package.json \
# Copy the rest of the source files into the image.
COPY . .
# Run the build script.
RUN yarn run build
################################################################################
# Create a new stage to run the application with minimal runtime dependencies
@ -49,9 +51,6 @@ FROM base as final
# Use production node environment by default.
ENV NODE_ENV production
# Run the application as a non-root user.
USER node
# Copy package.json so that package manager commands can be used.
COPY package.json .
@ -59,6 +58,10 @@ COPY package.json .
# the built application from the build stage into the image.
COPY --from=deps /usr/src/app/node_modules ./node_modules
COPY --from=build /usr/src/app/dist ./dist
COPY --from=build /usr/src/app/scripts ./scripts
COPY --from=build /usr/src/app/prisma ./prisma
COPY --from=build /usr/src/app/node_modules/@prisma/client/ ./node_modules/@prisma/client/
COPY --from=build /usr/src/app/node_modules/.prisma/client/ ./node_modules/.prisma/client/
# Run the application.
CMD yarn start

View File

@ -30,12 +30,30 @@ pnpm install mi-gpt
import { MiGPT } from "mi-gpt";
async function main() {
// coming soon
const client = MiGPT.create({
speaker: {
userId: process.env.MI_USER,
password: process.env.MI_PASS,
did: process.env.MI_DID,
},
});
await client.start();
}
main();
```
## 📦 Docker
Use the following command to start `MiGPT` within a Docker container.
```shell
# Ensure you have your `.env` file and `.migpt.js` configuration file ready for deployment.
docker run -d --env-file $(pwd)/.env \
-v $(pwd)/.migpt.js:/usr/src/app/.migpt.js \
idootop/mi-gpt:1.0.0
```
## 🌈 Embrace the future
Welcome to the era of intuitive living with MiGPT, where every command is a conversation, and every interaction is an opportunity for your home to become more in sync with you. Imagine a space that not only listens but also comprehends and evolves—a living space that's as dynamic and intelligent as the world around you. This is not just smart home technology; this is MiGPT, the heartbeat of your AI-driven home, where the future of home automation isn't just arriving, it's already here, ready to transform your daily living into an experience of effortless intelligence.

View File

@ -1,6 +1,6 @@
{
"name": "mi-gpt",
"version": "1.3.0",
"version": "1.0.0",
"type": "module",
"description": "Seamlessly integrate your XiaoAI speaker and Mi Home devices with ChatGPT for an enhanced smart home experience.",
"license": "MIT",
@ -19,11 +19,10 @@
"home-assistant"
],
"scripts": {
"build": "tsup",
"db:gen": "npx prisma migrate dev --name init",
"db:reset": "rm .bot.json && npx prisma migrate reset",
"prepublish": "npm run db:gen && npm run build",
"start": "node ./scripts/runner.js"
"build": "yarn prisma generate && tsup",
"start": "node ./scripts/runner.js",
"db:gen": "yarn prisma migrate dev --name init",
"db:reset": "rm -f .mi.json .bot.json prisma/app.db prisma/app.db-journal"
},
"dependencies": {
"@prisma/client": "^5.8.1",