Compare commits

...

5 Commits

Author SHA1 Message Date
leehuwuj a21dc86eaa update typescript start 2024-03-27 16:26:02 +07:00
leehuwuj 83681febd4 update docs for mounting .env file 2024-03-27 16:25:03 +07:00
leehuwuj 8ebd1651b3 update readme template 2024-03-27 16:17:42 +07:00
leehuwuj 4cbe8c6641 simpler python dockerifle 2024-03-27 16:13:04 +07:00
leehuwuj 90e38358b3 add dockerfile template 2024-03-27 16:10:43 +07:00
9 changed files with 121 additions and 1 deletions
+7 -1
View File
@@ -215,9 +215,10 @@ export const installPythonTemplate = async ({
},
});
const compPath = path.join(templatesDir, "components");
if (dataSources.length > 0) {
const enginePath = path.join(root, "app", "engine");
const compPath = path.join(templatesDir, "components");
const vectorDbDirName = vectorDb ?? "none";
const VectorDBPath = path.join(
@@ -304,4 +305,9 @@ export const installPythonTemplate = async ({
if (postInstallAction === "runApp" || postInstallAction === "dependencies") {
installPythonDependencies();
}
// Copy deployment files for python
await copy("**", root, {
cwd: path.join(compPath, "deployments", "python"),
});
};
+5
View File
@@ -303,4 +303,9 @@ export const installTSTemplate = async ({
if (postInstallAction === "runApp" || postInstallAction === "dependencies") {
await installTSDependencies(packageJson, packageManager, isOnline);
}
// Copy deployment files for typescript
await copy("**", root, {
cwd: path.join(compPath, "deployments", "typescript"),
});
};
@@ -0,0 +1,22 @@
FROM python:3.11 as build
WORKDIR /app
ENV PYTHONPATH=/app
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false
# Install dependencies
COPY ./pyproject.toml ./poetry.lock* /app/
RUN poetry install --no-root --no-cache --only main
# ====================================
FROM build as release
COPY . .
CMD ["python", "main.py"]
@@ -0,0 +1,19 @@
FROM node:20-alpine as build
WORKDIR /app
# Install dependencies
COPY package.json pnpm-lock.yaml* /app/
RUN npm install -g pnpm
RUN pnpm install
# Build the application
COPY . .
RUN pnpm run build
# ====================================
FROM build as release
RUN chmod +x start.sh
CMD ["/bin/sh", "start.sh"]
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
if [ "$ENVIRONMENT" = "dev" ]; then
echo "Running Development mode"
pnpm dev
else
echo "Running Production mode"
pnpm build
pnpm start
fi
@@ -51,6 +51,20 @@ The API allows CORS for all origins to simplify development. You can change this
ENVIRONMENT=prod python main.py
```
## Using docker
1. Build an image for FastAPI app:
```
docker build -t <your_backend_image_name> .
```
2. Run a container:
```
docker run --rm -v $(pwd)/.env:/app/.env -p 8000:8000 <your_backend_image_name>
```
## Learn More
To learn more about LlamaIndex, take a look at the following resources:
@@ -60,6 +60,20 @@ NODE_ENV=production npm run start
> Note that the `NODE_ENV` environment variable is set to `production`. This disables CORS for all origins.
## Using docker
1. Build an image for Express app:
```
docker build -t <your_backend_image_name> .
```
2. Run a container:
```
docker run --rm -v $(pwd)/.env:/app/.env -p 8000:8000 <your_backend_image_name>
```
## Learn More
To learn more about LlamaIndex, take a look at the following resources:
@@ -64,6 +64,20 @@ The API allows CORS for all origins to simplify development. You can change this
ENVIRONMENT=prod python main.py
```
## Using docker
1. Build an image for FastAPI app:
```
docker build -t <your_backend_image_name> .
```
2. Run a container:
```
docker run --rm -v $(pwd)/.env:/app/.env -p 8000:8000 <your_backend_image_name>
```
## Learn More
To learn more about LlamaIndex, take a look at the following resources:
@@ -26,6 +26,20 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Using docker
1. Build an image for Next app:
```
docker build -t <your_app_image_name> .
```
2. Run a container:
```
docker run --rm -v $(pwd)/.env:/app/.env -p 3000:3000 <your_app_image_name>
```
## Learn More
To learn more about LlamaIndex, take a look at the following resources: