From d731a2bad30aaec2e1f1d63e2bb57062e1ccd503 Mon Sep 17 00:00:00 2001 From: Clifton Palmer Date: Sat, 28 Oct 2023 07:23:28 -0500 Subject: [PATCH] Dynamic gallery discovery --- .gitignore | 1 + Dockerfile | 3 ++- app/app.py | 5 +++-- app/templates/gallery.html | 15 +++++++++++++++ docker-compose.yml | 8 ++++++++ 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 app/templates/gallery.html diff --git a/.gitignore b/.gitignore index bee8a64..bec372b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +*.swp __pycache__ diff --git a/Dockerfile b/Dockerfile index 0ef69aa..c3e0f83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,9 @@ RUN apk update && \ apk add --no-cache gcc musl-dev linux-headers libpq-dev python3-dev WORKDIR /app -COPY ./app /app COPY ./requirements.txt /app RUN pip install -r requirements.txt +COPY ./app /app + CMD ["flask", "run"] diff --git a/app/app.py b/app/app.py index c4d55bd..86cbf79 100644 --- a/app/app.py +++ b/app/app.py @@ -3,5 +3,6 @@ from flask import Flask, render_template app = Flask(__name__) @app.route('/') -def customer(): - return render_template('hello.html') +def render_gallery(): + items = ['LittleWilly', 'foo', 'bar'] + return render_template( 'gallery.html', gallery_items=items ) diff --git a/app/templates/gallery.html b/app/templates/gallery.html new file mode 100644 index 0000000..7f893b1 --- /dev/null +++ b/app/templates/gallery.html @@ -0,0 +1,15 @@ + + + + Gallery + + +

Gallery

+ + + + diff --git a/docker-compose.yml b/docker-compose.yml index bc5f097..8a86772 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,16 @@ services: build: . image: cjpalmer/gallery:0.1.0 volumes: + - gallery_data:/app/gallery - ./app:/app environment: FLASK_DEBUG: 1 ports: - 80:5000 +volumes: + gallery_data: + driver: local + driver_opts: + o: bind + type: none + device: /mnt/gallery_data -- 2.47.2