Skip to content

Commit

Permalink
Update project setup to run with Docker
Browse files Browse the repository at this point in the history
- Update .eslintrc.json to disable certain rules
- Add NEXTAUTH_SECRET and OPENAI_API_KEY environment variables to .env
- Modify package.json to disable lint during the build process
- Update .gitignore to ignore the /db directory
- Update README.md with instructions on how to run the app with Docker

These changes allow the application to be built and run within a Docker container, while maintaining data persistence using a mounted volume for the SQLite database.
  • Loading branch information
Frajder committed Apr 11, 2023
1 parent 6e57069 commit bec0e18
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"plugins": ["@typescript-eslint"],
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/consistent-type-imports": "warn"
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# database
/prisma/db.sqlite
/prisma/db.sqlite-journal
/db/db.sqlite

# next.js
/.next/
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,26 @@ npx prisma db push
# Run the project:
npm run dev
```

## Run in docker

```bash
# set the environment variable NEXTAUTH_SECRET and OPENAI_API_KEY
OPENAI_API_KEY="sk..."
NEXTAUTH_SECRET=$(openssl rand -base64 32)

echo "NODE_ENV=development\n\
NEXTAUTH_SECRET=$NEXTAUTH_SECRET\n\
NEXTAUTH_URL=http://localhost:3000\n\
OPENAI_API_KEY=$OPENAI_API_KEY\n\
DATABASE_URL=file:./db/db.sqlite\n" > .env

# Build docker image
docker build -t agentgpt .

# Create db dir for db.sqlite
mkdir $(pwd)/db

# Run docker
docker run -d --name agentgpt -p 3000:3000 -v $(pwd)/db:/app/db agentgpt
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"build": "next build",
"build": "next build --no-lint",
"dev": "next dev",
"postinstall": "prisma generate",
"lint": "next lint",
Expand Down

0 comments on commit bec0e18

Please sign in to comment.