Initial import
This commit is contained in:
parent
96f5ccfd14
commit
746baa95a6
3 changed files with 58 additions and 0 deletions
7
Dockerfile
Normal file
7
Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FROM python:slim
|
||||||
|
|
||||||
|
RUN pip install flask
|
||||||
|
COPY beer.py /beer.py
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD python /beer.py
|
17
beer.py
Executable file
17
beer.py
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env python3.6
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
with open('static/beer.html') as f:
|
||||||
|
data = f.read()
|
||||||
|
return data
|
||||||
|
|
||||||
|
@app.route('/hello/<phrase>')
|
||||||
|
def hello(phrase):
|
||||||
|
return phrase
|
||||||
|
|
||||||
|
app.run(host='::')
|
34
static/beer.html
Normal file
34
static/beer.html
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<!-- Display the countdown timer in an element -->
|
||||||
|
<p id="demo"></p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Update the count down every 1 second
|
||||||
|
|
||||||
|
var x = setInterval(function() {
|
||||||
|
|
||||||
|
// Get today's date and time
|
||||||
|
// var now = new Date().getTime();
|
||||||
|
var now = new Date().getTime();
|
||||||
|
var today = new Date();
|
||||||
|
today.setHours(17, 00);
|
||||||
|
var goal = today.getTime();
|
||||||
|
|
||||||
|
// Find the distance between now and the count down date
|
||||||
|
var distance = goal - now;
|
||||||
|
|
||||||
|
// Time calculations for days, hours, minutes and seconds
|
||||||
|
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||||
|
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||||
|
|
||||||
|
// Display the result in the element with id="demo"
|
||||||
|
document.getElementById("demo").innerHTML = hours + "h "
|
||||||
|
+ minutes + "m ";
|
||||||
|
|
||||||
|
// If the count down is finished, write some text
|
||||||
|
if (distance < 0) {
|
||||||
|
clearInterval(x);
|
||||||
|
document.getElementById("demo").innerHTML = "BEER TIME !";
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue