diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1513c39 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,94 @@ +# Git +.git +.gitignore + +# CI +.codeclimate.yml +.travis.yml +.taskcluster.yml + +# Docker +docker-compose.yml +.docker +Dockerfile + +# Byte-compiled / optimized / DLL files +__pycache__/ +*/__pycache__/ +*/*/__pycache__/ +*/*/*/__pycache__/ +*.py[cod] +*/*.py[cod] +*/*/*.py[cod] +*/*/*/*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Virtual environment +.env/ +.venv/ +venv/ + +# PyCharm +.idea + +# Python mode for VIM +.ropeproject +*/.ropeproject +*/*/.ropeproject +*/*/*/.ropeproject + +# Vim swap files +*.swp +*/*.swp +*/*/*.swp +*/*/*/*.swp diff --git a/.gitignore b/.gitignore index 545c490..a1db2f1 100644 --- a/.gitignore +++ b/.gitignore @@ -171,3 +171,6 @@ cython_debug/ .pypirc .python-version pyrightconfig.json + +# Ollama Local Dir +ollama diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2dba618 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.12-alpine AS base + +# VENV not needed in docker container +ENV POETRY_VIRTUALENVS_CREATE=false + +COPY ./entrypoint.sh / + +WORKDIR /app + +COPY . . + +# Install dependencies +RUN apk add curl +RUN pip install poetry +RUN poetry install + +FROM base as dev + +# Expose development port +EXPOSE 5000 + +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a93d2f1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +services: + senju: + build: + context: . + target: dev + ports: + - "127.0.0.1:5000:5000" + volumes: + - ./senju:/app + depends_on: + - ollama + + ollama: + image: docker.io/ollama/ollama + volumes: + - ./ollama:/root/.ollama + container_name: ollama + environment: + - OLLAMA_KEEP_ALIVE=24h + - OLLAMA_HOST=0.0.0.0 + + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..ea3ed14 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +curl http://ollama:11434/api/pull -d '{"model": "llama3.2:1b"}' + +flask --app senju/main run --debug --host=0.0.0.0 +