Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cloud-native
lab-docker-demo
Commits
b284c0e5
Commit
b284c0e5
authored
Nov 14, 2021
by
Nane Kratzke
Browse files
Solution
parent
9737a4cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
b284c0e5
FROM
python:3-
slim
FROM
python:3-
alpine
WORKDIR
/app
ADD
requirements.txt ./
RUN
pip
install
-r
requirements.txt
RUN
pip
install
-r
requirements.txt
&&
\
rm
requirements.txt
CMD
["python", "-u", "app.py"]
...
...
app.py
View file @
b284c0e5
from
flask
import
Flask
,
request
from
flask
import
Flask
,
request
,
abort
import
wikipedia
app
=
Flask
(
__name__
,
static_folder
=
"static"
)
@
app
.
route
(
"/"
)
def
index
():
content
=
request
.
args
.
get
(
'proof'
,
default
=
""
)
return
f
"""<h1>Hello</h1>
I am generated content:
<p>
{
content
}
</p>
"""
wiki
=
request
.
args
.
get
(
'wiki'
,
default
=
"Lübeck"
)
try
:
wikipedia
.
set_lang
(
"de"
)
content
=
wikipedia
.
page
(
wiki
).
summary
return
f
"""<h1>
{
wiki
}
</h1>
Ich habe dies auf Wikipedia gefunden:
<p>
{
content
}
</p>
"""
except
:
abort
(
404
,
f
"
{
wiki
}
not found"
)
print
(
"Starting ..."
)
#
print("Starting ...")
app
.
run
(
host
=
"0.0.0.0"
,
port
=
8080
)
\ No newline at end of file
requirements.txt
View file @
b284c0e5
flask
pandas
\ No newline at end of file
wikipedia
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment