Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii-Klimov committed Oct 5, 2023
0 parents commit df1198e
Show file tree
Hide file tree
Showing 74 changed files with 5,271 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
**/__pycache__
**/venv
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LOG_LEVEL=DEBUG
OPENAI_API_BASE=http://localhost:5000
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
# E501 string literal is too long
# W503 line break before binary operator
# E203 whitespace before ':' (triggered on list slices like xs[i : i + 5])
ignore = E501, W503, E203
exclude =
.venv,
.nox,
.pytest_cache,
__pycache__,
14 changes: 14 additions & 0 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"LABEL": {
"name": "",
"color": "EEEEEE"
},
"CHECKS": {
"prefixes": ["fix: ", "feat: ", "feature: ", "chore: ", "hotfix: "]
},
"MESSAGES": {
"success": "All OK",
"failure": "Missing prefix",
"notice": ""
}
}
15 changes: 15 additions & 0 deletions .github/workflows/pr_check_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Code checks - tests

on:
pull_request:
branches:
- development
- release-*

jobs:
run_tests:
uses: epam/ai-dial-ci/.github/workflows/test_python_docker.yml@0.1.0
with:
bypass_checks: false
python_version: 3.11
secrets: inherit
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release version

on:
push:
branches: [ development, release-* ]

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
release:
uses: epam/ai-dial-ci/.github/workflows/publish_python_docker.yml@0.1.0
secrets: inherit
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
**/node_modules/
*.egg-info
.DS_Store
__pycache__
.vs/
.gradle/
.idea/
*.suo
*.user
*.nupkg
*.dll
obj/
bin/
build/
out/
.tmp
.env
~*
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"justMyCode": false
}
]
}
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"editor.formatOnSave": true,
"python.analysis.typeCheckingMode": "basic",
"cSpell.enabled": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/__pycache__": true,
"**/.pytest_cache": true,
"**/.gradle": true,
"**/bin": true,
"**/build": true,
".idea": true,
".venv": true
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.11-alpine AS builder

ARG POETRY_VERSION=1.6.1

# Install alpine-sdk to compile some langchain dependencies (numexpr, numpy)

RUN pip install --upgrade pip
RUN pip install poetry==$POETRY_VERSION

# Test if Poetry is installed in the expected path
RUN echo "Poetry version:" && poetry --version

# Set the working directory for the app
WORKDIR /app
COPY pyproject.toml poetry.lock poetry.toml ./

# Install dependencies
RUN poetry install --no-interaction --no-ansi --only main

COPY aidial_assistant/ ./aidial_assistant/

# Use a multi-stage build to run the server
FROM python:3.11-alpine

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

ENV LOG_LEVEL=INFO

# Install libstdc++ to run the compiled dependencies

# Create a non-root user with an explicit UID
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 1001 --disabled-password --gecos "" appuser
# Copy and add permission to access the /app folder
COPY --chown=appuser --from=builder /app /app
WORKDIR /app

# "Activate" the virtual environment
ENV PATH=/app/.venv/bin:$PATH

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
EXPOSE 5000

USER appuser
CMD ["uvicorn", "aidial_assistant.app:app", "--host", "0.0.0.0", "--port", "5000", "--workers", "10"]
Loading

0 comments on commit df1198e

Please sign in to comment.