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

basic dockerfile with usage #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ Useful in a variety of situations where you have too much information to learn a

## Deploying the App

### Digital Ocean
Click this button to deploy the app to the DigitalOcean App Platform. If you are not logged in, you will be prompted to log in with your DigitalOcean account.

[![Deploy to DigitalOcean](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/squarecat/doc-buddy/tree/main&refcode=1f67a87765d4)

When you get to the "Review" section of the deploy, make sure to set the plan to `Basic` as it will default to `Pro`. The chat component should run fine on a $5/mo sized instance, and the memory component will probably be fine at $5 also, but much faster at $10/mo.

### Docker
1. `docker build -t doc-buddy`
2. Fill in container.env file with your keys from the Getting Started section
3. `docker run -p 3000:80 -d doc-buddy --env-file container.env`

## Environment Variables

You'll need to add these to the DigitalOcean app env variables.
Expand Down
12 changes: 12 additions & 0 deletions container.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
OPEN_AI_MODEL=
OPEN_AI_KEY=
TELEGRAM_TOKEN=
EMBEDDINGS_BEARER_TOKEN=
STORAGE_NAME=
STORAGE_URL=
STORAGE_KEY=
STORAGE_SECRET=
DATASTORE=
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=
PINECONE_INDEX=
20 changes: 20 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Node.js runtime as a parent image
FROM node:14-alpine

Choose a reason for hiding this comment

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

Node 14 is now EOL. The most recent LTS version is node:18.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also developing and testing on 18 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

ok min version is 16, I just added nvmrc file and engines prop in the package.json


# Set working directory
WORKDIR /app

# Copy the package.json and package-lock.json files to the working directory
COPY package*.json ./

Choose a reason for hiding this comment

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

The repository contains a yarn.lock file, so it should grab that file and install with yarn instead of npm install to grab the frozen dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, lets make this change 👍


# Install app dependencies
RUN npm install

# Copy the rest of the app files to the working directory
COPY . .

# Expose port 3000
EXPOSE 3000

Choose a reason for hiding this comment

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

I made the same mistake in my Dockerfile, but the index.js is using an environment variable PORT to set the port, or defaulting to 1333. So this should be 1333 or a PORT environment variable should be set in the Dockerfile.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, lets set a PORT env var please


# Start the app
CMD ["node", "index.js"]