-
Notifications
You must be signed in to change notification settings - Fork 4
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
6 changed files
with
87 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ubuntu:16.04 | ||
LABEL maintainer="[email protected]" | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y python3-pip python3 && \ | ||
pip3 install flask Pillow && mkdir /home/uploads && mkdir /home/templates | ||
|
||
ADD server.py /home/ | ||
ADD templates /home/templates | ||
WORKDIR /home/uploads | ||
ENTRYPOINT ["python3", "/home/server.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,33 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: flask-api-deployment | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: flask-api | ||
spec: | ||
containers: | ||
- name: flask-api | ||
image: nlkey2022/flask_test | ||
imagePullPolicy: Always | ||
volumeMounts: | ||
- mountPath: "/home/uploads" | ||
name: pv | ||
resources: | ||
limits: | ||
cpu: 150m | ||
memory: 200Mi | ||
requests: | ||
cpu: 150m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 5000 | ||
nodeSelector: | ||
application: "flask" | ||
volumes: | ||
- name: pv | ||
persistentVolumeClaim: | ||
claimName: test-claim |
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,19 @@ | ||
#!/usr/bin/env python3 | ||
from flask import Flask, render_template, request | ||
from werkzeug import secure_filename | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def index(): | ||
return render_template('index.html') | ||
|
||
@app.route('/upload', methods=['POST']) | ||
def upload(): | ||
if request.method == 'POST': | ||
f = request.files.get('file') | ||
fname = secure_filename(f.filename) | ||
f.save(fname) | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', debug=False) |
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,11 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: flask-api-service | ||
spec: | ||
type: LoadBalancer | ||
ports: | ||
- port: 80 | ||
targetPort: 5000 | ||
selector: | ||
app: flask-api |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>upload Test</title> | ||
</head> | ||
<body> | ||
<form action = "/upload" method = "POST" enctype = "multipart/form-data"> | ||
<input type = "file" name = "file" /> | ||
<input type = "submit"/> | ||
</form> | ||
</body> | ||
</html> |
Empty file.