Skip to content

Commit

Permalink
Merge branch 'hyperledger-labs:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sonustar authored Sep 14, 2024
2 parents b57668b + 62b4aa7 commit 653c66d
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM node:20-alpine AS frontend-build
WORKDIR /app/frontend
COPY frontend .
RUN yarn install

FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS backend-build
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PATH="/usr/local/bin:${PATH}"
RUN apt-get update && \
apt-get install -y python3-pip python3-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app/core
COPY core/requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu118

FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PATH="/usr/local/bin:${PATH}"
ENV NODE_VERSION=20.x
RUN apt-get update && apt-get install -y \
python3-pip \
wget \
curl \
&& curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY --from=backend-build /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
COPY core ./core
COPY --from=frontend-build /app/frontend ./frontend
COPY frontend/package.json frontend/yarn.lock ./frontend/
WORKDIR /app/frontend
RUN yarn install --production
WORKDIR /app
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
EXPOSE 3000 8080
ENTRYPOINT ["./entrypoint.sh"]
30 changes: 30 additions & 0 deletions src/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
```bash
docker build -t aifaq .
```
Now run this image from this command
```bash
docker run --gpus all -p 3000:3000 -p 8080:8080 aifaq
```

### To check the frontend running on the lightining ai studio.
1. Click on this add icon.

![alt text](image-3.png)

2. Install the web port from here .

![alt text](image.png)

3. Now click on this icon.

![alt text](image-1.png)

4. Now update the port 3000 in here.

![alt text](image-2.png)

### The Backend can be checked using this curl request on the new terminal by this curl request.

```console
curl --header "Content-Type: application/json" --request POST --data '{"text": "How to install Hyperledger fabric?"}' http://127.0.0.1:8080/query
```
8 changes: 8 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cd /app/core
python3 fetch_and_organize_data.py
python3 api.py &

cd /app/frontend
yarn dev
Binary file added src/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 653c66d

Please sign in to comment.