7 changed files with 78 additions and 89 deletions
@ -1,21 +1,5 @@ |
|||||
# Use an official Python runtime as a parent image |
# Use the Nginx unprivileged as a parent image |
||||
FROM python:3.8-slim |
FROM docker.io/nginxinc/nginx-unprivileged:1.25-alpine |
||||
|
|
||||
# Set the working directory in the container |
# Copy the static content into the container at /usr/share/nginx/html/ |
||||
WORKDIR /app |
COPY src/local/index.html /usr/share/nginx/html/ |
||||
|
|
||||
# Copy the current directory contents into the container at /app |
|
||||
COPY src /app |
|
||||
|
|
||||
# Install any needed packages specified in requirements.txt |
|
||||
RUN pip install --trusted-host pypi.python.org Flask |
|
||||
|
|
||||
# Make port 80 available to the world outside this container |
|
||||
EXPOSE 5000 |
|
||||
|
|
||||
# Define environment variable |
|
||||
ENV NAME World |
|
||||
|
|
||||
# Run app.py when the container launches |
|
||||
CMD ["python", "app.py"] |
|
||||
|
|
||||
|
|||||
@ -1,20 +0,0 @@ |
|||||
import platform |
|
||||
from flask import Flask, render_template |
|
||||
|
|
||||
app = Flask(__name__, template_folder="/app/templates") |
|
||||
|
|
||||
|
|
||||
@app.route('/') |
|
||||
def system_info(): |
|
||||
system_info = { |
|
||||
'System': platform.system(), |
|
||||
'Node Name': platform.node(), |
|
||||
'Release': platform.release(), |
|
||||
'Version': platform.version(), |
|
||||
'Machine': platform.machine(), |
|
||||
'Processor': platform.processor() |
|
||||
} |
|
||||
return render_template('index.html', system_info=system_info) |
|
||||
|
|
||||
if __name__ == '__main__': |
|
||||
app.run(host="0.0.0.0", debug=True) |
|
||||
@ -0,0 +1,36 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
<meta http-equiv="refresh" content="5"> |
||||
|
<style> |
||||
|
body { |
||||
|
font-family: Arial, sans-serif; |
||||
|
margin: 0; |
||||
|
padding: 0; |
||||
|
background-color: #f2f2f2; |
||||
|
} |
||||
|
|
||||
|
header { |
||||
|
background-color: #333; |
||||
|
color: white; |
||||
|
padding: 1em; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
main { |
||||
|
margin: 2em; |
||||
|
} |
||||
|
</style> |
||||
|
<title>Kiosk application</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<header> |
||||
|
<h1>Kiosk application</h1> |
||||
|
</header> |
||||
|
<main> |
||||
|
<p>You are viewing the <strong>local</strong> version.</p> |
||||
|
</main> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,36 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
<meta http-equiv="refresh" content="5"> |
||||
|
<style> |
||||
|
body { |
||||
|
font-family: Arial, sans-serif; |
||||
|
margin: 0; |
||||
|
padding: 0; |
||||
|
background-color: #f2f2f2; |
||||
|
} |
||||
|
|
||||
|
header { |
||||
|
background-color: #333; |
||||
|
color: white; |
||||
|
padding: 1em; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
main { |
||||
|
margin: 2em; |
||||
|
} |
||||
|
</style> |
||||
|
<title>Kiosk application</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<header> |
||||
|
<h1>Kiosk application</h1> |
||||
|
</header> |
||||
|
<main> |
||||
|
<p>You are viewing the <strong>online</strong> version.</p> |
||||
|
</main> |
||||
|
</body> |
||||
|
</html> |
||||
@ -1,18 +0,0 @@ |
|||||
/* static/style.css */ |
|
||||
body { |
|
||||
font-family: Arial, sans-serif; |
|
||||
margin: 0; |
|
||||
padding: 0; |
|
||||
background-color: #f2f2f2; |
|
||||
} |
|
||||
|
|
||||
header { |
|
||||
background-color: #333; |
|
||||
color: white; |
|
||||
padding: 1em; |
|
||||
text-align: center; |
|
||||
} |
|
||||
|
|
||||
main { |
|
||||
margin: 2em; |
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
<!-- templates/system_info.html --> |
|
||||
<!DOCTYPE html> |
|
||||
<html lang="en"> |
|
||||
<head> |
|
||||
<meta charset="UTF-8"> |
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"> |
|
||||
<title>System Information</title> |
|
||||
</head> |
|
||||
<body> |
|
||||
<header> |
|
||||
<h1>System Information</h1> |
|
||||
</header> |
|
||||
<main> |
|
||||
<table> |
|
||||
<tr> |
|
||||
<th>Attribute</th> |
|
||||
<th>Value</th> |
|
||||
</tr> |
|
||||
{% for key, value in system_info.items() %} |
|
||||
<tr> |
|
||||
<td>{{ key }}</td> |
|
||||
<td>{{ value }}</td> |
|
||||
</tr> |
|
||||
{% endfor %} |
|
||||
</table> |
|
||||
</main> |
|
||||
</body> |
|
||||
</html> |
|
||||
Loading…
Reference in new issue