From adb0859ae1ca87b65ba68428088fa24faa86e338 Mon Sep 17 00:00:00 2001 From: dtomlinson Date: Tue, 18 Feb 2020 16:50:40 +0000 Subject: [PATCH] updating docker deployment --- grandnational-dashboard/.gitignore | 1 + grandnational-dashboard/Dockerfile | 8 ++ grandnational-dashboard/app/.DS_Store | Bin 0 -> 6148 bytes grandnational-dashboard/app/__init__.py | 1 + grandnational-dashboard/app/main.py | 32 ++++++ .../app/templates/index.html | 102 ++++++++++++++++++ grandnational-dashboard/dashboard.Dockerfile | 8 ++ .../templates/index.html | 20 ++-- grandnational-dashboard/package-lock.json | 5 + grandnational-dashboard/package.json | 1 + grandnational-dashboard/requirements.txt | 17 +++ grandnational-dashboard/static/js/gn.js | 6 +- 12 files changed, 188 insertions(+), 13 deletions(-) create mode 100644 grandnational-dashboard/Dockerfile create mode 100644 grandnational-dashboard/app/.DS_Store create mode 100644 grandnational-dashboard/app/__init__.py create mode 100644 grandnational-dashboard/app/main.py create mode 100644 grandnational-dashboard/app/templates/index.html create mode 100644 grandnational-dashboard/dashboard.Dockerfile create mode 100644 grandnational-dashboard/requirements.txt diff --git a/grandnational-dashboard/.gitignore b/grandnational-dashboard/.gitignore index 279a436..52b89ef 100644 --- a/grandnational-dashboard/.gitignore +++ b/grandnational-dashboard/.gitignore @@ -138,3 +138,4 @@ dmypy.json *node_modules *font-awesome *.mp4 +*docker-image diff --git a/grandnational-dashboard/Dockerfile b/grandnational-dashboard/Dockerfile new file mode 100644 index 0000000..72cfe71 --- /dev/null +++ b/grandnational-dashboard/Dockerfile @@ -0,0 +1,8 @@ +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 + +RUN ["pip", "install", "aiofiles", "jinja2" ] + +COPY ./app /app +COPY ./node_modules /node_modules +COPY ./bower_components /bower_components +COPY ./static /static diff --git a/grandnational-dashboard/app/.DS_Store b/grandnational-dashboard/app/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c469b0071676fd5872f57944869513908b9db5d5 GIT binary patch literal 6148 zcmeHKy^hmB5T4BiE+Ge`K+2VFkSGomBf%k|lS~N3bqFIU0Ojo1x>&NkQS1M&!8(1 z@m{nQDQU|&Ad_Q6lv4-4E7V`{HU`6hVc=h5KzzG3`OQX@(&G0!-i>+JkGT&IaXj2a zyYy8Gw0TsY#?&Pbtw*64=TOwUUyF+OZMVx4eQK0GA3c7;+ikt7%KP$k^We*eTgQ0^ zzv12QEv`Z&O&b&-yA0X+#GwuFEKavW?63xW7ul)eBn&BmXN)MJXUoj6mp_m2M_FIz z`qA&lQI@nITdavWE^kP~(4jmhM4bIWQ@x2%bM{RULKd3Ad_ ztyUTr?Va7dWc+OMeEQ-*kcM)AdLZSz#yPx!Qozmf{@1P*doAw$y^Xi8UaP$?7%$;J z_WgLzf;}%7@2NXTW1j9~UGvQ58J%3znN(^gHwCkD!+>Gn4>2Il2MbN0qj9EC9v$f9 z6#!UCU&pws18Dxwr`qDjF!ODI4`<4hqe5c5Ys(qKBnz+YwH8xLL8=l}o! literal 0 HcmV?d00001 diff --git a/grandnational-dashboard/app/__init__.py b/grandnational-dashboard/app/__init__.py new file mode 100644 index 0000000..b794fd4 --- /dev/null +++ b/grandnational-dashboard/app/__init__.py @@ -0,0 +1 @@ +__version__ = '0.1.0' diff --git a/grandnational-dashboard/app/main.py b/grandnational-dashboard/app/main.py new file mode 100644 index 0000000..7eb60e8 --- /dev/null +++ b/grandnational-dashboard/app/main.py @@ -0,0 +1,32 @@ +from starlette.applications import Starlette +from starlette.templating import Jinja2Templates +from starlette.routing import Route, Mount +from starlette.staticfiles import StaticFiles + + +templates = Jinja2Templates(directory='templates') + + +async def home(request): + return templates.TemplateResponse( + 'index.html', + {'request': request}, + ) + + +routes = [ + Route('/', endpoint=home), + Mount('/static', StaticFiles(directory='../static'), name='static'), + Mount( + '/node_modules', + StaticFiles(directory='../node_modules'), + name='node_modules', + ), + Mount( + '/bower_components', + StaticFiles(directory='../bower_components'), + name='bower_components', + ), +] + +app = Starlette(debug=True, routes=routes) diff --git a/grandnational-dashboard/app/templates/index.html b/grandnational-dashboard/app/templates/index.html new file mode 100644 index 0000000..3201dd4 --- /dev/null +++ b/grandnational-dashboard/app/templates/index.html @@ -0,0 +1,102 @@ + + + + + Capacity Dashboard + + + + + + + + {# #} + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ +
+
+

Grand National 2020

+ +
+
+

Cheltenham 2020

+ +
+
+
+
+
+
+
+
+
+
+

Cheltenham Festival 2020

+
+

Day One 🐴 Tuesday 10th March

+
Featuring the Unibet Champion Hurdle
+
+

Day Two 🐴 Wednesday 11th March

+
Featuring the Betway Queen Mother Champion Chase
+
+

Day Three 🐴 Thursday 12th March

+
Featuring the Ryanair Chase
+
+

Gold Cup Day 🏆 Friday 13th March

+
Featuring the Magners Cheltenham Gold Cup
+
+
+

Grand National 2020

+
+

Liverpool's Day 🐴 Thursday 2nd April

+
Featuring the Betway Aintree Hurdle
+
+

Ladies Day at Aintree 🐴 Friday 3rd April

+
Featuring the JLT Melling Steeple
+
+

Grand National Day 🏆 Saturday 4th April

+
Featuring the Randox Health Grand National Steeple Chase
+
+

1st Favourite: Tiger Roll 🇮🇪

+
2nd Favourite: Burrows Saint 🇫🇷
+
+
+
+
+ + + + diff --git a/grandnational-dashboard/dashboard.Dockerfile b/grandnational-dashboard/dashboard.Dockerfile new file mode 100644 index 0000000..72cfe71 --- /dev/null +++ b/grandnational-dashboard/dashboard.Dockerfile @@ -0,0 +1,8 @@ +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 + +RUN ["pip", "install", "aiofiles", "jinja2" ] + +COPY ./app /app +COPY ./node_modules /node_modules +COPY ./bower_components /bower_components +COPY ./static /static diff --git a/grandnational-dashboard/grandnational_dashboard/templates/index.html b/grandnational-dashboard/grandnational_dashboard/templates/index.html index c3fb0b7..3201dd4 100644 --- a/grandnational-dashboard/grandnational_dashboard/templates/index.html +++ b/grandnational-dashboard/grandnational_dashboard/templates/index.html @@ -25,7 +25,7 @@ - + @@ -70,28 +70,28 @@
Featuring the Unibet Champion Hurdle

Day Two 🐴 Wednesday 11th March

-
Featuring The Betway Queen Mother Champion Chase
+
Featuring the Betway Queen Mother Champion Chase

Day Three 🐴 Thursday 12th March

-
Featuring The Ryanair Chase
+
Featuring the Ryanair Chase

-

Gold Cup Day 🏆 - Friday 13th March

-
Featuring The Magners Cheltenham Gold Cup
+

Gold Cup Day 🏆 Friday 13th March

+
Featuring the Magners Cheltenham Gold Cup

Grand National 2020


Liverpool's Day 🐴 Thursday 2nd April

-
Featuring The Betway Aintree Hurdle
+
Featuring the Betway Aintree Hurdle

Ladies Day at Aintree 🐴 Friday 3rd April

-
Featuring The JLT Melling Steeple
+
Featuring the JLT Melling Steeple

-

Grand National Day 🏆 - Saturday 4th April

-
Featuring The Randox Health Grand National Steeple Chase
+

Grand National Day 🏆 Saturday 4th April

+
Featuring the Randox Health Grand National Steeple Chase

1st Favourite: Tiger Roll 🇮🇪

-

2nd Favourite: Burrows Saint 🇫🇷

+
2nd Favourite: Burrows Saint 🇫🇷
diff --git a/grandnational-dashboard/package-lock.json b/grandnational-dashboard/package-lock.json index 78b01d4..9ea05d3 100644 --- a/grandnational-dashboard/package-lock.json +++ b/grandnational-dashboard/package-lock.json @@ -4,6 +4,11 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@fortawesome/fontawesome-free": { + "version": "5.12.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.1.tgz", + "integrity": "sha512-ZtjIIFplxncqxvogq148C3hBLQE+W3iJ8E4UvJ09zIJUgzwLcROsWwFDErVSXY2Plzao5J9KUYNHKHMEUYDMKw==" + }, "bootswatch": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/bootswatch/-/bootswatch-4.4.1.tgz", diff --git a/grandnational-dashboard/package.json b/grandnational-dashboard/package.json index c66b36c..9db6aa8 100644 --- a/grandnational-dashboard/package.json +++ b/grandnational-dashboard/package.json @@ -13,6 +13,7 @@ "author": "", "license": "ISC", "dependencies": { + "@fortawesome/fontawesome-free": "^5.12.1", "bootswatch": "^4.4.1", "jq-fakeloader": "^2.0.1" } diff --git a/grandnational-dashboard/requirements.txt b/grandnational-dashboard/requirements.txt new file mode 100644 index 0000000..d4fb00c --- /dev/null +++ b/grandnational-dashboard/requirements.txt @@ -0,0 +1,17 @@ +aiofiles==0.4.0 +certifi==2019.11.28 +chardet==3.0.4 +click==7.0 +fastapi==0.49.0 +h11==0.9.0 +httptools==0.1.1; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy" +idna==2.8 +jinja2==2.11.1 +markupsafe==1.1.1 +pydantic==1.4 +requests==2.22.0 +starlette==0.12.9 +urllib3==1.25.8 +uvicorn==0.11.3 +uvloop==0.14.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy" +websockets==8.1 diff --git a/grandnational-dashboard/static/js/gn.js b/grandnational-dashboard/static/js/gn.js index cd976d5..be6f861 100644 --- a/grandnational-dashboard/static/js/gn.js +++ b/grandnational-dashboard/static/js/gn.js @@ -1,8 +1,8 @@ -$('#gn-countdown').countdown('2020/04/04', function(event) { +$('#gn-countdown').countdown('2020/04/04 17:15', function(event) { $(this).html(event.strftime('%D days %Hhrs %Mm %Ss')); }); -$('#chelt-countdown').countdown('2020/03/13', function(event) { +$('#chelt-countdown').countdown('2020/03/13 15:30', function(event) { $(this).html(event.strftime('%D days %Hhrs %Mm %Ss')); }); @@ -12,7 +12,7 @@ $("#event-rotate").Morphist({ // The exit animation type (Out). Refer to Animate.css for a list of available animations. animateOut: "zoomOutRight", // The delay between the changing of each object in milliseconds. - speed: 4000, + speed: 5000, complete: function () { // Called after the entrance animation is executed. }