-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
33 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,21 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder | ||
|
||
WORKDIR /app | ||
WORKDIR /dashboard | ||
|
||
RUN apk add nano openssh-server | ||
|
||
COPY requirements.txt /app | ||
COPY . /dashboard | ||
|
||
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 / / | ||
|
||
USER vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
Derived from this work | ||
https://github.com/docker/awesome-compose/tree/c2f8036fd353dae457eba7b9b436bf3a1c85d937/flask | ||
|
||
To test locally | ||
|
||
docker build -t flasktest . | ||
docker run --name flasktest -p 8000:8000 flasktest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
24 changes: 24 additions & 0 deletions
24
services/ansible_openvpn/docker/dashboard/scripts/serve.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
def home(): | ||
return """ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>NoiseSensor dashboard default page</title> | ||
</head> | ||
<body> | ||
<p>Please run the Ansible playbook named deploy_elastic_web_dashboard.yml</p> | ||
</body> | ||
</html>""" | ||
|
||
|
||
def main(): | ||
from waitress import serve | ||
import hupper | ||
reloader = hupper.start_reloader('scripts.serve.main') | ||
reloader.watch_files(['app_git_hash.txt']) | ||
serve(app, host="0.0.0.0", port=8000) |