Skip to content

Commit

Permalink
fix: Dockerfile for express and improve READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser committed Mar 28, 2024
1 parent 78ded9e commit ae15367
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
12 changes: 3 additions & 9 deletions templates/components/deployments/typescript/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM node:20-alpine as build
WORKDIR /app

# Install dependencies
COPY package.json pnpm-lock.yaml* /app/
RUN npm install
COPY package.json package-lock.* ./
RUN npm install

# Build the application
COPY . .
Expand All @@ -13,10 +13,4 @@ RUN npm run build
# ====================================
FROM build as release

# Copy built output from the previous stage
COPY --from=build /app/.next* ./.next
COPY --from=build /app/public* ./public
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/node_modules ./node_modules

CMD ["npm", "start"]
CMD ["npm", "run", "start"]
15 changes: 8 additions & 7 deletions templates/types/streaming/express/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,33 @@ NODE_ENV=production npm run start
## Using Docker

1. Build an image for Express app:
1. Build an image for the Express API:

```
docker build -t <your_backend_image_name> .
```

2. Start the app:
2. Generate embeddings:

- Generate index data:
Parse the data and generate the vector embeddings if the `./data` folder exists - otherwise, skip this step:

```
docker run --rm \
--v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system
-v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system
-v $(pwd)/config:/app/config \
-v $(pwd)/cache:/app/cache \ # Use your file system to store gea vector database
-v $(pwd)/data:/app/data \
-v $(pwd)/cache:/app/cache \ # Use your file system to store the vector database
<your_backend_image_name>
npm run generate
```

- Start the API:
3. Start the API:

```
docker run \
-v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system
-v $(pwd)/config:/app/config \
-v $(pwd)/cache:/app/cache \ # Use your file system to store gea vector database
-v $(pwd)/cache:/app/cache \ # Use your file system to store the vector database
-p 8000:8000 \
<your_backend_image_name>
```
Expand Down
13 changes: 7 additions & 6 deletions templates/types/streaming/fastapi/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,30 @@ The API allows CORS for all origins to simplify development. You can change this
ENVIRONMENT=prod python main.py
```

## Using docker
## Using Docker

1. Build an image for FastAPI app:
1. Build an image for the FastAPI app:

```
docker build -t <your_backend_image_name> .
```

2. Start the app:
2. Generate embeddings:

- Generate embedding for index data:
Parse the data and generate the vector embeddings if the `./data` folder exists - otherwise, skip this step:

```
docker run \
--rm \
-v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system
-v $(pwd)/config:/app/config \
-v $(pwd)/storage:/app/storage \ # Use your file system to store gea vector database
-v $(pwd)/data:/app/data \ # Use your local folder to read the data
-v $(pwd)/storage:/app/storage \ # Use your file system to store the vector database
<your_backend_image_name> \
python app/engine/generate.py
```

- Start the API:
3. Start the API:

```
docker run \
Expand Down
6 changes: 3 additions & 3 deletions templates/types/streaming/nextjs/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ docker run \
--rm \
-v $(pwd)/.env:/app/.env \ # Use ENV variables and configuration from your file-system
-v $(pwd)/config:/app/config \
-v $(pwd)/cache:/app/cache \ # Use your file system to store gea vector database
-p 3000:3000 \
-v $(pwd)/data:/app/data \
-v $(pwd)/cache:/app/cache \ # Use your file system to store the vector database
<your_app_image_name> \
npm run generate
```

3. Start the API
3. Start the app:

```
docker run \
Expand Down

0 comments on commit ae15367

Please sign in to comment.