-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4da5720
commit d5a33f2
Showing
8 changed files
with
475 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
.git | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.DS_Store | ||
**/__pycache__ | ||
**/.venv | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose.y*ml | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,69 @@ | ||
# Dockerfile | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Use a base image with Python | ||
FROM python:3.10.14 | ||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/go/dockerfile-reference/ | ||
|
||
# Set environment variables | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
ARG PYTHON_VERSION=3.10.14 | ||
FROM python:${PYTHON_VERSION} as base | ||
|
||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y jq && \ | ||
apt-get clean | ||
# Prevents Python from writing pyc files. | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Copy the Poetry lock files and install Poetry | ||
COPY pyproject.toml poetry.lock ./ | ||
RUN pip install poetry && poetry config virtualenvs.create false && poetry install --no-dev | ||
# Install ollama | ||
RUN curl -fsSL https://ollama.com/install.sh | sh | ||
# Keeps Python from buffering stdout and stderr to avoid situations where | ||
# the application crashes without emitting any logs due to buffering. | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN ollama serve& | ||
# RUN while [ "$(ollama list | grep 'NAME')" == "" ]; do sleep 1 done | ||
# RUN until ollama list | grep -q 'NAME'; do sleep 1; done | ||
# RUN timeout 120 bash -c 'until ollama list | grep -q "NAME"; do sleep 1; done' | ||
RUN ollama serve & sleep 5 && ollama run llama3 | ||
WORKDIR /app | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
# ARG UID=10001 | ||
# RUN adduser \ | ||
# --disabled-password \ | ||
# --gecos "" \ | ||
# --home "/nonexistent" \ | ||
# --shell "/sbin/nologin" \ | ||
# --no-create-home \ | ||
# --uid "${UID}" \ | ||
# appuser | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds. | ||
# Leverage a bind mount to requirements.txt to avoid having to copy them into | ||
# into this layer. | ||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||
--mount=type=bind,source=requirements.txt,target=requirements.txt \ | ||
python -m pip install -r requirements.txt | ||
|
||
# RUN ollama pull llama3 | ||
# Switch to the non-privileged user to run the application. | ||
# USER appuser | ||
|
||
# Copy the application code | ||
COPY . . | ||
# Copy the source code into the container. | ||
COPY ./data ./data | ||
COPY ./backend ./backend | ||
COPY ./documentation_bot ./documentation_bot | ||
COPY ./frontend ./frontend | ||
COPY ./structured_query ./structured_query | ||
COPY ./ollama ./ollama | ||
COPY ./llm_service ./llm_service | ||
COPY ./start_docker_local.sh ./start_docker_local.sh | ||
COPY ./start_local.sh ./start_local.sh | ||
COPY ./start_training.sh ./start_training.sh | ||
COPY ./stop_docker.sh ./stop_docker.sh | ||
|
||
# Expose the necessary ports | ||
EXPOSE 8000 8081 8083 8050 11434 8501 | ||
RUN curl -fsSL https://ollama.com/install.sh | sh | ||
RUN ollama serve & sleep 5 && ollama run llama3 | ||
# Expose the port that the application listens on. | ||
EXPOSE 8000 | ||
EXPOSE 8081 | ||
EXPOSE 8083 | ||
EXPOSE 8501 | ||
EXPOSE 11434 | ||
|
||
# Start the application | ||
CMD ["bash", "start_docker_local.sh"] | ||
# Run the application. | ||
# CMD uvicorn 'backend.backend:app' --host=0.0.0.0 --port=8000 | ||
# CMD [ "ls" ] | ||
CMD [ "./start_docker_local.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
### Building and running your application | ||
|
||
When you're ready, start your application by running: | ||
`docker compose up --build`. | ||
|
||
Your application will be available at http://localhost:8000. | ||
|
||
### Deploying your application to the cloud | ||
|
||
First, build your image, e.g.: `docker build -t myapp .`. | ||
If your cloud uses a different CPU architecture than your development | ||
machine (e.g., you are on a Mac M1 and your cloud provider is amd64), | ||
you'll want to build the image for that platform, e.g.: | ||
`docker build --platform=linux/amd64 -t myapp .`. | ||
|
||
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. | ||
|
||
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) | ||
docs for more detail on building and pushing. | ||
|
||
### References | ||
* [Docker's Python guide](https://docs.docker.com/language/python/) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Docker Compose reference guide at | ||
# https://docs.docker.com/go/compose-spec-reference/ | ||
|
||
# Here the instructions define your application as a service called "server". | ||
# This service is built from the Dockerfile in the current directory. | ||
# You can add other services your application may depend on here, such as a | ||
# database or a cache. For examples, see the Awesome Compose repository: | ||
# https://github.com/docker/awesome-compose | ||
services: | ||
server: | ||
build: | ||
context: . | ||
ports: | ||
- 8000:8000 | ||
- 8081:8081 | ||
- 8083:8083 | ||
- 8501:8501 | ||
- 11434:11434 | ||
|
||
# The commented out section below is an example of how to define a PostgreSQL | ||
# database that your application can use. `depends_on` tells Docker Compose to | ||
# start the database before your application. The `db-data` volume persists the | ||
# database data between container restarts. The `db-password` secret is used | ||
# to set the database password. You must create `db/password.txt` and add | ||
# a password of your choosing to it before running `docker compose up`. | ||
# depends_on: | ||
# db: | ||
# condition: service_healthy | ||
# db: | ||
# image: postgres | ||
# restart: always | ||
# user: postgres | ||
# secrets: | ||
# - db-password | ||
# volumes: | ||
# - db-data:/var/lib/postgresql/data | ||
# environment: | ||
# - POSTGRES_DB=example | ||
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password | ||
# expose: | ||
# - 5432 | ||
# healthcheck: | ||
# test: [ "CMD", "pg_isready" ] | ||
# interval: 10s | ||
# timeout: 5s | ||
# retries: 5 | ||
# volumes: | ||
# db-data: | ||
# secrets: | ||
# db-password: | ||
# file: db/password.txt | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.