mirror of
https://github.com/senju1337/senju.git
synced 2025-12-24 07:39:29 +00:00
Merge pull request #11 from senju1337/feat/container
Feat/container: Adding initial multistage dockerfile for mainpage and compose file. Also add container for ollama ai.
This commit is contained in:
commit
e22a2b8312
5 changed files with 148 additions and 0 deletions
94
.dockerignore
Normal file
94
.dockerignore
Normal file
|
|
@ -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
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -171,3 +171,6 @@ cython_debug/
|
|||
.pypirc
|
||||
.python-version
|
||||
pyrightconfig.json
|
||||
|
||||
# Ollama Local Dir
|
||||
ollama
|
||||
|
|
|
|||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
|
|
@ -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"]
|
||||
22
docker-compose.yml
Normal file
22
docker-compose.yml
Normal file
|
|
@ -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
|
||||
|
||||
|
||||
6
entrypoint.sh
Normal file
6
entrypoint.sh
Normal file
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue