Skip to content

Commit

Permalink
chore(js): Fix langchain-express and llama-index-express docker examp…
Browse files Browse the repository at this point in the history
…les (#1120)
  • Loading branch information
cephalization authored Nov 13, 2024
1 parent c415c76 commit 999ff42
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions js/examples/langchain-express/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPENAI_API_KEY=
4 changes: 3 additions & 1 deletion js/examples/langchain-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

## Getting Started With Docker-Compose

Ensure that Docker is installed and running. Run the command `docker compose up` to spin up services for the frontend, backend, and Phoenix. Once those services are running, open [http://localhost:3000](http://localhost:3000) to use the chat interface. When you're finished, run `docker compose down` to spin down the services.
Copy the `.env.example` file to `.env` and set your `OPENAI_API_KEY`.

Ensure that Docker is installed and running. Run the command `docker compose up` to spin up services for the frontend, backend, and Phoenix. Once those services are running, open [http://localhost:3000](http://localhost:3000) to use the chat interface and [http://localhost:6006](http://localhost:6006) to view the Phoenix UI. When you're finished, run `docker compose down` to spin down the services.

## Learn More

Expand Down
1 change: 1 addition & 0 deletions js/examples/langchain-express/backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
8 changes: 4 additions & 4 deletions js/examples/langchain-express/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
RUN npm i
RUN npm i --quiet

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . /app/
COPY . .
RUN npm run build

# Production image, copy all the files and run the server
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/dist ./dist
COPY package*.json ./
RUN npm i --production
COPY --from=deps /app/node_modules ./node_modules
COPY package.json ./
EXPOSE 8000
CMD ["node", "--import", "./dist/instrumentation.cjs", "./dist/index.cjs"]
9 changes: 7 additions & 2 deletions js/examples/langchain-express/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ services:
ports:
- "6006:6006"
backend:
build: backend
build:
context: backend
dockerfile: Dockerfile
ports:
- "8000:8000"
env_file: .env
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- COLLECTOR_ENDPOINT=http://phoenix:6006/v1/traces
Expand All @@ -18,7 +21,9 @@ services:
timeout: 1s
retries: 5
frontend:
build: frontend
build:
context: frontend
dockerfile: Dockerfile
ports:
- "3000:3000"
depends_on:
Expand Down
1 change: 1 addition & 0 deletions js/examples/langchain-express/frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion js/examples/langchain-express/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
RUN npm i
RUN npm i --quiet

# Rebuild the source code only when needed
FROM base AS builder
Expand Down
1 change: 1 addition & 0 deletions js/examples/llama-index-express/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPENAI_API_KEY=
4 changes: 3 additions & 1 deletion js/examples/llama-index-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

## Getting Started With Docker-Compose

Ensure that Docker is installed and running. Run the command `docker compose up` to spin up services for the frontend, backend, and Phoenix. Once those services are running, open [http://localhost:3000](http://localhost:3000) to use the chat interface. When you're finished, run `docker compose down` to spin down the services.
Copy the `.env.example` file to `.env` and set your `OPENAI_API_KEY`.

Ensure that Docker is installed and running. Run the command `docker compose up` to spin up services for the frontend, backend, and Phoenix. Once those services are running, open [http://localhost:3000](http://localhost:3000) to use the chat interface and [http://localhost:6006](http://localhost:6006) to view the Phoenix UI. When you're finished, run `docker compose down` to spin down the services.

## Learn More

Expand Down
1 change: 1 addition & 0 deletions js/examples/llama-index-express/backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 2 additions & 2 deletions js/examples/llama-index-express/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package*.json ./
RUN npm ci
RUN npm i --quiet

# Rebuild the source code only when needed
FROM base AS builder
Expand All @@ -20,7 +20,7 @@ FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/dist ./dist
COPY --from=deps /app/node_modules ./node_modules
COPY package*.json ./
RUN npm i --production
EXPOSE 8000
CMD ["node", "--import", "./dist/instrumentation.cjs", "./dist/index.cjs"]
1 change: 1 addition & 0 deletions js/examples/llama-index-express/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
interval: 5s
timeout: 1s
retries: 5
env_file: .env
frontend:
build: frontend
ports:
Expand Down
1 change: 1 addition & 0 deletions js/examples/llama-index-express/frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion js/examples/llama-index-express/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package*.json ./
RUN npm ci
RUN npm i --quiet

# Rebuild the source code only when needed
FROM base AS builder
Expand Down

0 comments on commit 999ff42

Please sign in to comment.