Compare commits

..

10 Commits

10 changed files with 197 additions and 528 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.html

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM python:3.12
WORKDIR /usr/local/app
# Install the application dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in the source code
COPY . .
EXPOSE 5000
# Setup an app user so the container doesn't run as the root user
RUN useradd app
USER app
CMD ["cd", "/usr/local/app"]
CMD "ls"
CMD ["flask", "--app", "build", "run", "--host=0.0.0.0"]]

View File

@ -7,29 +7,51 @@ env = Environment(
autoescape=select_autoescape() autoescape=select_autoescape()
) )
with open('menu.yaml', 'r') as file: def generateMenu():
menu = yaml.safe_load(file) with open('menu.yaml', 'r') as file:
menu = yaml.safe_load(file)
templateMenu = env.get_template("menu.html") templateMenu = env.get_template("menu.html")
templateRecipes = env.get_template("recipes.html") templateRecipes = env.get_template("recipes.html")
for bev in menu['menu']: for bev, details in menu['menu'].items():
#print(bev) #print(bev)
for name in bev: print(bev)
print(name) #for ingredient in details['ingredients']:
for ingredient in bev[name]['ingredients']: # print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>')
print(f'<li>{ingredient[list(ingredient)[0]]} {list(ingredient)[0]}</li>') details['directions_html'] = markdown.markdown(details['directions'])
print(markdown.markdown(bev[name]['directions']))
bev[name]['directions_html'] = markdown.markdown(bev[name]['directions'])
with open('index.html', 'w') as file: menuHtml = templateMenu.render(bevs = menu['menu'])
file.write(templateMenu.render(bevs = menu['menu'])) recipesHtml = templateRecipes.render(bevs = menu['menu'])
return {'menuHtml': menuHtml, 'recipesHtml': recipesHtml}
with open('recipes.html', 'w') as file: if (__name__ == 'build'):
file.write(templateRecipes.render(bevs = menu['menu'])) from flask import Flask
print(menu['menu']) app = Flask(__name__)
@app.route("/")
def serveMenu():
return generateMenu()['menuHtml']
@app.route("/recipes")
def serveRecipes():
return generateMenu()['recipesHtml']
elif (__name__ == '__main__'):
html = generateMenu()
with open('index.html', 'w') as file:
file.write(html['menuHtml'])
with open('recipes.html', 'w') as file:
file.write(html['recipesHtml'])
for ingredient in menu['out_of_stock']: print(generateMenu())
print(ingredient) #print(menu)
#
#
#
#for ingredient in menu['out_of_stock']:
# print(ingredient)
#
#print(__name__)

View File

@ -1,183 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<title>Cocktail Menu</title>
</head>
<body class="menu">
<main>
<h1>Cocktails</h1>
<h2>Old Fashioned</h2>
<ul>
<li>Bourbon</li>
<li>Maple syrup</li>
<li>Angostura bitters</li>
</ul>
<h2>Boulevardier</h2>
<ul>
<li>Bourbon</li>
<li>Campari</li>
<li>Sweet vermouth</li>
</ul>
<h2>Black Manhattan</h2>
<ul>
<li>Rye whiskey</li>
<li>Amaro</li>
<li>Angostura bitters</li>
<li>Orange bitters</li>
</ul>
<h2>MonteNegroni</h2>
<ul>
<li>Amaro Montenegro</li>
<li>Gin</li>
<li>Sweet vermouth</li>
<li>Angostura bitters</li>
</ul>
<h2>Sidecar</h2>
<ul>
<li>Bourbon</li>
<li>Cointreau</li>
<li>Lemon juice</li>
</ul>
<h2>Gin &amp; Tonic</h2>
<ul>
<li>Gin</li>
<li>Tonic water</li>
</ul>
<h2>Gimlet</h2>
<ul>
<li>Gin</li>
<li>Lime juice</li>
<li>Simple syrup</li>
</ul>
<h2>Bennet</h2>
<ul>
<li>Gin</li>
<li>Lime juice</li>
<li>Simple syrup</li>
<li>Angostura bitters</li>
</ul>
</main>
</body>
</html>

199
menu.yaml
View File

@ -1,87 +1,122 @@
--- ---
menu: menu:
- Old Fashioned: Old Fashioned:
base: Bourbon base: Bourbon
category: Ancestrals category: Ancestrals
ingredients: ingredients:
- Bourbon: 2 oz Bourbon: 2 oz
- Maple syrup: 1tsp Maple syrup: 1tsp
- Angostura bitters: 2 dashes Angostura bitters: 2 dashes
directions: | directions: |
1. Stir with ice. Strain into rocks glass over large cube. 1. Stir with ice. Strain into rocks glass over large cube.
1. Garnish with orange twist. 1. Garnish with orange twist.
- Boulevardier: Boulevardier:
base: Bourbon base: Bourbon
category: Spirit-Forward category: Spirit-Forward
ingredients: ingredients:
- Bourbon: 1.5 oz Bourbon: 1.5 oz
- Campari: 1 oz Campari: 1 oz
- Sweet vermouth: 1 oz Sweet vermouth: 1 oz
directions: | directions: |
1. Stir with ice. Strain into rocks glass over large cube. 1. Stir with ice. Strain into rocks glass over large cube.
1. Garnish with orange twist. 1. Garnish with orange twist.
- Black Manhattan: Manhattan:
base: Rye whiskey base: Bourbon
category: Spirit-Forward category: Ancestrals
ingredients: ingredients:
- Rye whiskey: 2 oz Bourbon: 1.5 oz
- Amaro: 1 oz Sweet vermouth: 1 oz
- Angostura bitters: 1 dash Angostura bitters: 2 dashes
- Orange bitters: 1 dash directions: |
directions: | 1. Stir with ice.
1. Stir with ice. Strain into chilled coupe. 2. Strain into chilled coupe.
1. Garnish with orange twist. 3. Garnish with cherry or orange twist.
- MonteNegroni: Black Manhattan:
base: Amaro Montenegro & Gin base: Rye whiskey
category: category: Spirit-Forward
ingredients: ingredients:
- Amaro Montenegro: 1 1/3 oz Rye whiskey: 2 oz
- Gin: 2/3 oz Amaro: 1 oz
- Sweet vermouth: 2/3 oz Angostura bitters: 1 dash
- Angostura bitters: 2 drops Orange bitters: 1 dash
directions: | directions: |
1. Stir with ice. Strain into rocks glass over large cube. 1. Stir with ice. Strain into chilled coupe.
1. Garnish with orange twist. 1. Garnish with orange twist.
- Sidecar: MonteNegroni:
base: Bourbon base: Amaro Montenegro & Gin
category: Sours category:
ingredients: ingredients:
- Bourbon: 2 oz Amaro Montenegro: 1 1/3 oz
- Cointreau: 1 oz Gin: 2/3 oz
- Lemon juice: 0.5 oz Sweet vermouth: 2/3 oz
directions: | Angostura bitters: 2 drops
1. Shake with ice. Double strain into chilled coupe. directions: |
- "Gin & Tonic": 1. Stir with ice. Strain into rocks glass over large cube.
base: Gin 1. Garnish with orange twist.
category: Highballs Sidecar:
ingredients: base: Bourbon
- Gin: 2 oz category: Sours
- Tonic water: 4 oz ingredients:
directions: | Bourbon: 2 oz
1. Pour gin and tonic over ice in short glass. Cointreau: 1 oz
1. Stir gently. Lemon juice: 0.5 oz
1. Garnish with lime wheel. directions: |
- Gimlet: 1. Shake with ice. Double strain into chilled coupe.
base: Gin "Gin & Tonic":
category: Sours base: Gin
ingredients: category: Highballs
- Gin: 2 oz ingredients:
- Lime juice: 1 oz Gin: 2 oz
- Simple syrup: 0.5 oz Tonic water: 4 oz
directions: | directions: |
1. Shake with ice. 1. Pour gin and tonic over ice in short glass.
1. Double strain into chilled coupe. 1. Stir gently.
- Bennet: 1. Garnish with lime wheel.
base: Gin Gimlet:
category: Sours base: Gin
ingredients: category: Sours
- Gin: 2 oz ingredients:
- Lime juice: 1 oz Gin: 2 oz
- Simple syrup: 0.5 oz Lime juice: 1 oz
- Angostura bitters: 1 dash Simple syrup: 0.5 oz
directions: | directions: |
1. Shake with ice. 1. Shake with ice.
1. Double strain into chilled coupe. 1. Double strain into chilled coupe.
Bennet:
base: Gin
category: Sours
ingredients:
Gin: 2 oz
Lime juice: 1 oz
Simple syrup: 0.5 oz
Angostura bitters: 1 dash
directions: |
1. Shake with ice.
1. Double strain into chilled coupe.
Garibaldi:
base: Campari
category: Highballs
ingredients:
Campari: 1.5 oz
Orange juice: 4.5 oz
directions: |
1. Blend orange juice and Campari until frothy.
1. Strain into ice-filled highball.
White Russian:
base: Vodka
category:
ingredients:
Vodka: 1.5 oz
Kahlua: 1 oz
Heavy cream: 1 oz
Instant coffee: 0.5 tsp
directions: |
1. Chill vodka
1. Add large cube to lowball glass
1. Sprinkle instant coffee powder over ice
1. Slowly pour vodka around ice
1. Slowly pour Kahlua around ice
1. Slowly pour cream over ice
out_of_stock: out_of_stock:
- Rye whiskey - Rye whiskey

View File

@ -1,231 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<title>Cocktail Menu</title>
</head>
<body class="recipes">
<main>
<h1>Recipes</h1>
<h2>Old Fashioned</h2>
<ul>
<li>2 oz Bourbon</li>
<li>1tsp Maple syrup</li>
<li>2 dashes Angostura bitters</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Stir with ice. Strain into rocks glass over large cube.</li>
<li>Garnish with orange twist.</li>
</ol></p>
<h2>Boulevardier</h2>
<ul>
<li>1.5 oz Bourbon</li>
<li>1 oz Campari</li>
<li>1 oz Sweet vermouth</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Stir with ice. Strain into rocks glass over large cube.</li>
<li>Garnish with orange twist.</li>
</ol></p>
<h2>Black Manhattan</h2>
<ul>
<li>2 oz Rye whiskey</li>
<li>1 oz Amaro</li>
<li>1 dash Angostura bitters</li>
<li>1 dash Orange bitters</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Stir with ice. Strain into chilled coupe.</li>
<li>Garnish with orange twist.</li>
</ol></p>
<h2>MonteNegroni</h2>
<ul>
<li>1 1/3 oz Amaro Montenegro</li>
<li>2/3 oz Gin</li>
<li>2/3 oz Sweet vermouth</li>
<li>2 drops Angostura bitters</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Stir with ice. Strain into rocks glass over large cube.</li>
<li>Garnish with orange twist.</li>
</ol></p>
<h2>Sidecar</h2>
<ul>
<li>2 oz Bourbon</li>
<li>1 oz Cointreau</li>
<li>0.5 oz Lemon juice</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Shake with ice. Double strain into chilled coupe.</li>
</ol></p>
<h2>Gin &amp; Tonic</h2>
<ul>
<li>2 oz Gin</li>
<li>4 oz Tonic water</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Pour gin and tonic over ice in short glass.</li>
<li>Stir gently.</li>
<li>Garnish with lime wheel.</li>
</ol></p>
<h2>Gimlet</h2>
<ul>
<li>2 oz Gin</li>
<li>1 oz Lime juice</li>
<li>0.5 oz Simple syrup</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Shake with ice.</li>
<li>Double strain into chilled coupe.</li>
</ol></p>
<h2>Bennet</h2>
<ul>
<li>2 oz Gin</li>
<li>1 oz Lime juice</li>
<li>0.5 oz Simple syrup</li>
<li>1 dash Angostura bitters</li>
</ul>
<h3>Directions</h3>
<p><ol>
<li>Shake with ice.</li>
<li>Double strain into chilled coupe.</li>
</ol></p>
</main>
</body>
</html>

11
requirements.txt Normal file
View File

@ -0,0 +1,11 @@
blinker==1.9.0
click==8.1.8
Flask==3.1.0
importlib_metadata==8.6.1
itsdangerous==2.2.0
Jinja2==3.1.5
Markdown==3.7
MarkupSafe==3.0.2
PyYAML==6.0.2
Werkzeug==3.1.3
zipp==3.21.0

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="static/style.css">
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
</head> </head>
<body class="{% block bodyclass %}{% endblock %}"> <body class="{% block bodyclass %}{% endblock %}">

View File

@ -3,17 +3,13 @@
{% block bodyclass %}menu{% endblock %} {% block bodyclass %}menu{% endblock %}
{% block content %} {% block content %}
<h1>{% block header %}Cocktails{% endblock %}</h1> <h1>{% block header %}Cocktails{% endblock %}</h1>
{% for bev in bevs %} {% for name, details in bevs.items() %}
{% for name, details in bev.items() %} <h2>{{ name }}</h2>
<h2>{{ name }}</h2> <ul>
<ul> {% for name, amount in details['ingredients'].items() %}
{% for ingredient in details['ingredients'] %} <li>{% block amount scoped %}{% endblock %}{{ name }}</li>
{% for name, amount in ingredient.items() %} {% endfor %}
<li>{% block amount scoped %}{% endblock %}{{ name }}</li> </ul>
{% endfor %} {% block directions scoped %}{% endblock %}
{% endfor %}
</ul>
{% block directions scoped %}{% endblock %}
{% endfor %}
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}