Skip to content

Commit

Permalink
Merge pull request #19 from Renumics/chore/deployment
Browse files Browse the repository at this point in the history
Chore/deployment
  • Loading branch information
druzsan authored Jun 27, 2024
2 parents f11d9c6 + b5caf61 commit c469132
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.envrc
.gitignore
.pre-commit-config.yaml
.prettierrc.yaml
LICENSE
Makefile
assets/
notebooks/

.env
data/
dev/
dist/

.vscode/
.idea/

.DS_Store
__pycache__/
.mypy_cache/
.ruff_cache/
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.11

ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_PORT=8000

WORKDIR /app

RUN pip install -IU pip setuptools wheel && pip install poetry==1.8.3

COPY pyproject.toml poetry.lock README.md ./
COPY ./assistant/__init__.py ./assistant/

RUN poetry install --extras=openai --sync --without=dev

COPY ./assistant/ ./assistant/
COPY settings.yaml ./

COPY ./db-docs/ ./db-docs/

CMD ["poetry", "run", "app"]
35 changes: 33 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,37 @@ lint: ## Lint all source files
run: ## Run web app
poetry run streamlit run assistant/app.py

.PHONY: build
build: ## Build package
.PHONY: build-wheel
build-wheel: ## Build package
poetry build -f wheel

.PHONY: build-image
build-image: ## Build docker image
docker build -t renumics-rag -f Dockerfile .

.PHONY: run-image-openai
run-image-openai: ## Build docker image
run-image-openai: build-image
docker run -it --rm -e OPENAI_API_KEY=$$OPENAI_API_KEY -p 8000:8000 renumics-rag

.PHONY: run-image-azure
run-image-azure: ## Build docker image
run-image-azure: build-image
docker run -it --rm \
-e OPENAI_API_TYPE=$$OPENAI_API_TYPE \
-e OPENAI_API_VERSION=$$OPENAI_API_VERSION \
-e AZURE_OPENAI_API_KEY=$$AZURE_OPENAI_API_KEY \
-e AZURE_OPENAI_ENDPOINT=$$AZURE_OPENAI_ENDPOINT -p 8000:8000 renumics-rag

.PHONY: docker-login
docker-login: ## Log in to Azure registry
docker login -u "$$AZURE_REGISTRY_USERNAME" -p "$$AZURE_REGISTRY_PASSWORD" "$$AZURE_REGISTRY"

.PHONY: release-image
release-image: ## Tag and push image to Azure registry
release-image: docker-login build-image
TIMESTAMP="$(shell date '+%Y-%m-%d_%H-%M-%S')"
docker tag renumics-rag "$${AZURE_REGISTRY}/renumics-rag:$$TIMESTAMP"
docker push "$${AZURE_REGISTRY}/renumics-rag:$$TIMESTAMP"
docker tag renumics-rag "$${AZURE_REGISTRY}/renumics-rag:latest"
docker push "$${AZURE_REGISTRY}/renumics-rag:latest"

0 comments on commit c469132

Please sign in to comment.