initial commit
This commit is contained in:
commit
5e8991fabc
3 changed files with 31 additions and 0 deletions
13
Dockerfile
Normal file
13
Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM python:3-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["gunicorn", "--workers=3", "--bind", ":8000", "app:app"]
|
16
app.py
Normal file
16
app.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from flask import Flask, request
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/headers')
|
||||
def show_headers():
|
||||
# Get headers from request object
|
||||
headers = dict(request.headers)
|
||||
|
||||
# Convert the headers dictionary into a string with key-value pairs separated by commas
|
||||
headers_str = '\n'.join(f'{key}: {value}' for key, value in headers.items())
|
||||
|
||||
return f'Headers:\n{headers_str}'
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Flask
|
||||
gunicorn
|
Loading…
Add table
Reference in a new issue