Skip to content

Commit

Permalink
devika dockerfile uv venv setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sounishnath003 committed Mar 24, 2024
1 parent 8e252c9 commit af72d0c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
10 changes: 5 additions & 5 deletions app.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ RUN groupadd -r nonroot && useradd -r -g nonroot -d /home/nonroot/client -s /bin

# install node js
RUN apt-get update && apt-get upgrade
RUN apt-get install -y build-essential software-properties-common curl sudo wget
RUN apt-get install -y build-essential software-properties-common curl sudo wget git
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
RUN apt-get install nodejs

# copying devika app client only
COPY ui /home/nonroot/client/
COPY src /home/nonroot/client/
COPY ui /home/nonroot/client/ui
COPY src /home/nonroot/client/src
COPY config.toml /home/nonroot/client/

RUN npm install && npm upgrade
RUN cd ui && npm install && npm upgrade -g npm
RUN chown -R nonroot:nonroot /home/nonroot/client

USER nonroot
WORKDIR /home/nonroot/client
WORKDIR /home/nonroot/client/ui

ENTRYPOINT [ "npm", "run", "dev" ]
17 changes: 8 additions & 9 deletions devika.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,26 @@ ENV PYTHONDONTWRITEBYTECODE 1

# setting up python3
RUN apt-get update && apt-get upgrade
RUN apt-get install -y build-essential software-properties-common curl sudo wget
RUN apt-get install -y build-essential software-properties-common curl sudo wget git
RUN apt-get install -y python3 python3-pip
RUN curl -fsSL https://astral.sh/uv/install.sh | sudo -E bash -
RUN export PATH=$PATH:$HOME/.cargo/bin
RUN echo $PATH
RUN $HOME/.cargo/bin/uv venv
RUN python3 -V && pip3 -V
ENV PATH="/home/nonroot/devika/.venv/bin:$HOME/.cargo/bin:$PATH"
RUN echo $PATH

# copy devika python engine only
RUN $HOME/.cargo/bin/uv venv
COPY requirements.txt /home/nonroot/devika/
RUN $HOME/.cargo/bin/uv pip install -r requirements.txt
RUN $HOME/.cargo/bin/uv pip install flask flask-cors

COPY src /home/nonroot/devika/src
COPY config.toml /home/nonroot/devika/
COPY devika.py /home/nonroot/devika/
RUN ls

RUN chown -R nonroot:nonroot /home/nonroot/devika
USER nonroot
RUN ls -al

USER nonroot
WORKDIR /home/nonroot/devika
ENV PATH="/home/nonroot/devika/.venv/bin:$HOME/.cargo/bin:$PATH"

ENTRYPOINT [ "python3", "devika.py" ]
ENTRYPOINT [ "python3", "-m", "devika" ]
31 changes: 26 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
version: "3.9"

services:
llama2-llm-service:
ollama-service:
image: ollama/ollama:latest
networks:
- devika-subnetwork
expose:
- 11434
ports:
- 11434:11434
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:11434/ || exit 1"]
interval: 5s
timeout: 30s
retries: 5
start_period: 30s
networks:
- devika-subnetwork

devika-backend-engine:
build:
context: .
dockerfile: devika.dockerfile
depends_on:
- llama2-llm-service
- ollama-service
expose:
- 1337
ports:
- 1337:1337
environment:
- OLLAMA_HOST=http://ollama-service:11434
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:1337/ || exit 1"]
interval: 5s
timeout: 30s
retries: 5
start_period: 30s
volumes:
- devika-backend-dbstore:/db
networks:
- devika-subnetwork

Expand All @@ -28,7 +44,9 @@ services:
context: .
dockerfile: app.dockerfile
depends_on:
- llama2-llm-service
- devika-backend-engine
environment:
- VITE_API_BASE_URL="http://devika-backend-engine:1337"
expose:
- 3000
ports:
Expand All @@ -38,3 +56,6 @@ services:

networks:
devika-subnetwork:

volumes:
devika-backend-dbstore:

0 comments on commit af72d0c

Please sign in to comment.