Skip to content
Snippets Groups Projects
Commit ae153676 authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

fix: Dockerfile for express and improve READMEs

parent 78ded9e2
No related branches found
No related tags found
No related merge requests found
......@@ -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 . .
......@@ -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"]
\ No newline at end of file
CMD ["npm", "run", "start"]
\ No newline at end of file
......@@ -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>
```
......
......@@ -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 \
......
......@@ -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 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment