add full docker image with db

This commit is contained in:
LUIS NOVO 2024-11-08 18:30:34 -03:00
parent dc76d6b8d8
commit ee67258beb
7 changed files with 81 additions and 4 deletions

View file

@ -13,3 +13,6 @@ docker-compose*
docs/
surreal-data/
temp/
*.env
.mypy_cache/
.ruff_cache/

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.env
prompts/patterns/user/
notebooks/
data/

View file

@ -14,9 +14,10 @@ RUN pip install poetry --no-cache-dir
RUN poetry self add poetry-plugin-dotenv
RUN poetry config virtualenvs.create false
COPY . /app
COPY pyproject.toml poetry.lock /app/
RUN poetry install --only main
COPY . /app
EXPOSE 8502
RUN mkdir -p /app/data

36
Dockerfile_full Normal file
View file

@ -0,0 +1,36 @@
# Use an official Python runtime as a base image
FROM python:3.11.7-slim-bullseye
# Install system dependencies required for building certain Python packages
RUN apt-get update && apt-get install -y \
gcc \
curl wget libmagic-dev ffmpeg supervisor \
&& rm -rf /var/lib/apt/lists/*
# Install SurrealDB
RUN curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh
# Set the working directory in the container to /app
WORKDIR /app
COPY pyproject.toml poetry.lock /app/
RUN pip install poetry --no-cache-dir
RUN poetry self add poetry-plugin-dotenv
RUN poetry config virtualenvs.create false
RUN poetry install --only main
COPY . /app
# Create supervisor configuration directory
RUN mkdir -p /etc/supervisor/conf.d
# Copy supervisor configuration file
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 8502
RUN mkdir -p /app/data
# Use supervisor as the main process
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View file

@ -52,6 +52,8 @@ docker-update-latest: docker-buildx-prepare
# Release with latest
docker-release-all: docker-release docker-update-latest
dev:
docker compose -f docker-compose.dev.yml up --build
docker compose -f docker-compose.dev.yml up --build
full:
docker compose -f docker-compose.full.yml up --build

13
docker-compose.full.yml Normal file
View file

@ -0,0 +1,13 @@
version: '3'
services:
open_notebook_full:
build:
context: .
dockerfile: Dockerfile_full
ports:
- "8080:8502"
volumes:
- ./.docker_data/data:/app/data
- ./docker2.env:/app/.env
- ./google-credentials.json:/app/google-credentials.json

21
supervisord.conf Normal file
View file

@ -0,0 +1,21 @@
[supervisord]
nodaemon=true
logfile=/dev/stdout
logfile_maxbytes=0
pidfile=/tmp/supervisord.pid
[program:surrealdb]
command=surreal start --log trace --user root --pass root rocksdb:/mydata/mydatabase.db
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true
[program:streamlit]
command=poetry run streamlit run app_home.py
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true