First commit
This commit is contained in:
27
src/Dockerfile
Normal file
27
src/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt /app
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
COPY . /app
|
||||
|
||||
ENTRYPOINT ["python3"]
|
||||
CMD ["app.py"]
|
||||
|
||||
FROM builder as dev-envs
|
||||
|
||||
RUN <<EOF
|
||||
apk update
|
||||
apk add git
|
||||
EOF
|
||||
|
||||
RUN <<EOF
|
||||
addgroup -S docker
|
||||
adduser -S --shell /bin/bash --ingroup docker vscode
|
||||
EOF
|
||||
# install Docker tools (cli, buildx, compose)
|
||||
COPY --from=gloursdocker/docker / /
|
||||
22
src/app.py
Normal file
22
src/app.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from flask import Flask
|
||||
from flask import request
|
||||
from flask import render_template
|
||||
|
||||
from prometheus_flask_exporter import PrometheusMetrics
|
||||
|
||||
app = Flask(__name__)
|
||||
metrics = PrometheusMetrics(app)
|
||||
metrics.info('app_info', 'Application info', version='1.0.0')
|
||||
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello_geek():
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=False,host='0.0.0.0', port=8000)
|
||||
# app.run(host='0.0.0.0', port=8000)
|
||||
2
src/requirements.txt
Normal file
2
src/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
flask
|
||||
prometheus-flask-exporter
|
||||
5
src/templates/index.html
Normal file
5
src/templates/index.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<!doctype html>
|
||||
<title>Hello from Flask App demo</title>
|
||||
<h1>Application de demo</h1>
|
||||
<p>Exposition des métriques de l'application </p>
|
||||
<a href="/metrics">Accés à l'exporter</a>
|
||||
Reference in New Issue
Block a user