Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker support for easier setup and deployment #28

Merged
merged 3 commits into from
Apr 12, 2023

Conversation

Frajder
Copy link
Contributor

@Frajder Frajder commented Apr 11, 2023

This pull request adds Docker support to the project, allowing for an easier setup and deployment process. The changes made include:

  1. Updating .eslintrc.json to disable certain rules that were causing the build to fail.
  2. Adding the NEXTAUTH_SECRET and OPENAI_API_KEY environment variables to the .env file.
  3. Modifying package.json to disable lint during the build process.
  4. Updating .gitignore to ignore the /db directory.
  5. Updating README.md with instructions on how to run the app with Docker.

By adding Docker support, users can now easily build and run the application within a Docker container. This simplifies the setup process and ensures a consistent environment across different machines. Additionally, data persistence is maintained using a mounted volume for the SQLite database.

Please review the changes and let me know if any further modifications are required before merging.

Frajder added 2 commits April 12, 2023 00:13
- 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.
@vercel
Copy link

vercel bot commented Apr 11, 2023

@Frajder is attempting to deploy a commit to the reworkd Team on Vercel.

A member of the Team first needs to authorize it.

@awtkns
Copy link
Member

awtkns commented Apr 12, 2023

This is awesome, thank you so much 🚀

@vercel
Copy link

vercel bot commented Apr 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
agent-gpt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 2:11am

@awtkns awtkns self-requested a review April 12, 2023 02:12
RUN npm ci

# Copy the rest of the application code
COPY . .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure we don't want to be copying everything here (eg: the node modules)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI i made some changes in #34. Node modules are no longer being copied

@awtkns awtkns merged commit 5a4a135 into reworkd:main Apr 12, 2023
@Frajder
Copy link
Contributor Author

Frajder commented Apr 12, 2023

Tested and can confirm that it works perfectly! I just had to make the setup.sh file executable.

┌──(frajder㉿workstation)-[/git]
└─$ git clone https://github.com/reworkd/AgentGPT.git
Cloning into 'AgentGPT'...
remote: Enumerating objects: 967, done.
remote: Counting objects: 100% (315/315), done.
remote: Compressing objects: 100% (134/134), done.
remote: Total 967 (delta 218), reused 253 (delta 178), pack-reused 652
Receiving objects: 100% (967/967), 788.47 KiB | 6.02 MiB/s, done.
Resolving deltas: 100% (582/582), done.

┌──(frajder㉿workstation)-[/git]
└─$ cd AgentGPT

┌──(frajder㉿workstation)-[/git/AgentGPT]
└─$ ./setup.sh
-bash: ./setup.sh: Permission denied

┌──(frajder㉿workstation)-[/git/AgentGPT]
└─$ chmod +x setup.sh

┌──(frajder㉿workstation)-[/git/AgentGPT]
└─$ ./setup.sh                                                                                        
Enter your OpenAI Key (eg: sk...): sk-xxx
[+] Building 77.8s (13/13) FINISHED 
 => [internal] load .dockerignore 0.1s
 => => transferring context: 105B   	0.0s 
 => [internal] load build definition from Dockerfile 0.1s 
 => => transferring dockerfile: 746B  	0.0s 
 => [internal] load metadata for docker.io/library/node:19-alpine 1.2s 
 => [internal] load build context  	0.1s
 => => transferring context: 936.44kB 0.0s 
 => [1/8] FROM docker.io/library/node:19-alpine@sha256:53741c7511b1836b5eb7e788a7b399c058b0b549f205d2c6af831ec1a9a81c31 0.0s 
 => CACHED [2/8] WORKDIR /app     	0.0s 
 => [3/8] COPY package*.json ./   	0.1s 
 => [4/8] RUN npm ci             	22.1s 
 => [5/8] COPY . .                	0.1s 
 => [6/8] RUN mv .env.docker .env      && sed -ie 's/postgresql/sqlite/g' prisma/schema.prisma    && sed -ie 's/@db.Text//' prisma/schema.prisma  			0.5s 
 => [7/8] RUN npx prisma generate      && npx prisma migrate dev --name init      && npx prisma db push 10.2s 
 => [8/8] RUN npm run build      	34.4s 
 => exporting to image            	9.1s 
 => => exporting layers           	9.1s 
 => => writing image sha256:d607d5c1384e7a0c2096330b1b646be01c2705185806adb605d81ba87af72ba6  	0.0s 
 => => naming to docker.io/library/agentgpt  	0.0s 
 a633fdc3cccb27f6015e9cdfa2f447941bf22d89677692a8d0268d4bd372807e 

┌──(frajder㉿workstation)-[/git/AgentGPT]
└─$ docker logs agentgpt               

> agent-gpt@0.1.0 start
> next start

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /app/.env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants