From 74ea9751acb6d75e0f80fc37b84819a879aa63f9 Mon Sep 17 00:00:00 2001 From: Andreea Radoescu Date: Sun, 17 Nov 2024 19:32:43 +0100 Subject: change paths to flashcards repo to work in Docker, added Dockerfile that installs app and runs the UI - requires the flashcard data to be mounted from outside added docker-compose as a first draft --- Dockerfile | 5 +++++ docker-compose.yml | 12 ++++++++++++ gui-project/main.py | 2 -- gui-project/main_ui.py | 5 +++-- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1e4e089 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.12.7-bookworm +WORKDIR /app +COPY . . +RUN pip install -r requirements.txt +ENTRYPOINT ["python3", "gui-project/main.py"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e1339bb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.1' +services: + food-planner: + container_name: flashcards + image: local/flashcards + restart: unless-stopped + user: "$SERVICE_UID:$SERVICE_GID" + build: . + volumes: + - .:/app + - ./schwiizerduutsch:/app/schwiizerduutsch + - $SERVICE_ROOT/data:/data diff --git a/gui-project/main.py b/gui-project/main.py index d98b2c7..4a9e159 100644 --- a/gui-project/main.py +++ b/gui-project/main.py @@ -1,8 +1,6 @@ from nicegui import ui from main_ui import MainUI -FLASHCARDS_ROOT="/home/andreear/git/schwiizertuutsch/flashcards" - @ui.page("/") def main_page(): MainUI() diff --git a/gui-project/main_ui.py b/gui-project/main_ui.py index fcb1f5a..6bda821 100644 --- a/gui-project/main_ui.py +++ b/gui-project/main_ui.py @@ -5,8 +5,9 @@ import sys from cards import CardUI, CardComponent from flashcards import Session -FLASHCARDS_ROOT="/home/andreear/git/schwiizertuutsch/flashcards" -STATE_FILE="/home/andreear/git/flashcards/state.txt" +FLASHCARDS_ROOT="/app/schwiizertuutsch/flashcards" +STATE_FILE="/app/state.txt" +# FLASHCARDS_ROOT="/home/andreea/git/schwiizertuutsch/flashcards" class MainUI(): def __init__(self): -- cgit v1.2.3