Skip to content

Commit

Permalink
feat: add new app for Module 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampouille committed Oct 24, 2024
1 parent 6f6a25e commit ff25067
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Build images for trainings

on:
# trigger only on push to dev branch
push:
branches:
- dev

jobs:
build-and-push:
if: github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and push to ghcr
run: |
cd m03_developer/
docker build -t ghcr.io/camptocamp/courseware-containers-m03:monolith \
--pull --no-cache \
--label GIT_COMMIT=$(git rev-parse HEAD) .
docker push ghcr.io/camptocamp/courseware-containers-m03:monolith
docker build -t ghcr.io/camptocamp/courseware-containers-m03:static \
-f Dockerfile.static \
--pull --no-cache \
--label GIT_COMMIT=$(git rev-parse HEAD) .
docker push ghcr.io/camptocamp/courseware-containers-m03:monolith
18 changes: 18 additions & 0 deletions m03_developer/monolith/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.12-bookworm

WORKDIR /app

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
#ENV FLASK_APP=app.py

RUN pip install gunicorn

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

EXPOSE 8000
ENTRYPOINT ["gunicorn", "--bind=0.0.0.0"]
CMD ["app:app"]
4 changes: 4 additions & 0 deletions m03_developer/monolith/Dockerfile.static
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx:1

RUN mkdir /usr/share/nginx/html/static/
COPY static/* /usr/share/nginx/html/static/
10 changes: 10 additions & 0 deletions m03_developer/monolith/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def home():
return render_template('index.html')

if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=5000)
24 changes: 24 additions & 0 deletions m03_developer/monolith/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Flask",
"type": "debugpy",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py",
"FLASK_DEBUG": "1",
"PGHOST": "localhost",
},
"args": [
"run",
],
"jinja": true,
"autoStartBrowser": false
}
]
}
2 changes: 2 additions & 0 deletions m03_developer/monolith/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask
debugpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Ghastly Panic Font by Chad Savage
http://www.sinisterfonts.com

Created 2005, hand-lettered while watching the 2004 remake of "Dawn of the Dead".

This is a free font, and I mean FREE. Use it however you want, for whatever you want. If you make something cool with it, I'd love to see it - email me at [email protected] and tell me about it. If you offer it for download on your own font site, PLEASE include this Read Me. That's not too much to ask, is it?

This font is intended for specialty and graphic uses. It will look just awful if used in a paragraph format.

For more free fonts and other downloadable goodies, visit http://www.sinisterfonts.com.
Binary file added m03_developer/monolith/static/camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added m03_developer/monolith/static/ghastly_panic.ttf
Binary file not shown.
66 changes: 66 additions & 0 deletions m03_developer/monolith/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@font-face {
font-family: 'Ghastly Panic';
src: url('./ghastly_panic.ttf') format('truetype');
}

html {
font-size: 16pt;
height: 100%;
}
body {
min-height: 100%;
margin: 0;
padding: 0;
position: relative;
}
.greetings {
font-size: 70px;
color: white;
border: 2px solid black;
text-align: center;
background: black;
margin-top: 0;
font-family: 'Ghastly Panic', sans-serif;
letter-spacing: 7px;
padding: 20px 0 20px 0;
}
.cameraImage {
margin: auto;
display: block;
position: relative;
top: 100px;
}
footer {
background-color: black;
color: white;
padding: 20px 0;
text-align: center;
position: absolute;
bottom: 0;
font-family: sans-serif;
width: 100%;
}

footer a {
color: #ecf0f1;
text-decoration: none;
margin: 0 15px;
}

footer a:hover {
color: #f39c12;
}

.footer-content {
max-width: 1000px;
margin: 0 auto;
}

.social-media {
margin-top: 10px;
}

.social-media a {
margin: 0 10px;
font-size: 20px;
}
22 changes: 22 additions & 0 deletions m03_developer/monolith/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html>
<head>
<title>The Horror Movies</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<h1 class="greetings">The Horror Movies</h1>
<img class="cameraImage" src="{{ url_for('static', filename='camera.png') }}">
<footer>
<div class="footer-content">
<p>&copy; 2024 Created with vim.</p>
<div class="social-media">
<a href="#">Facebook</a>
<a href="#">Twitter</a>
<a href="#">Instagram</a>
<a href="#">LinkedIn</a>
</div>
</div>
</footer>
</body>
</html>

0 comments on commit ff25067

Please sign in to comment.