-
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.
Co-authored-by: jagaldol <[email protected]>
- Loading branch information
Showing
21 changed files
with
154 additions
and
41 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,13 @@ | ||
FROM python:3.8-alpine | ||
|
||
COPY . /app | ||
|
||
WORKDIR /app | ||
|
||
RUN pip install Flask-Mail | ||
|
||
RUN pip install flask | ||
|
||
RUN chmod +x /app/app.py | ||
|
||
CMD ["python3", "app.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,42 @@ | ||
from flask import Flask, request, Response | ||
import smtplib | ||
from email.mime.text import MIMEText | ||
|
||
app = Flask(__name__) | ||
|
||
# HTTP POST 요청을 처리하는 엔드포인트 | ||
@app.route('/email', methods=['POST']) | ||
def sendEmailEndpoint(): | ||
|
||
try: | ||
jsonRequest = request.get_json() | ||
|
||
subject = str(jsonRequest.get('subject')[0]) | ||
text = str(jsonRequest.get('text')[0]) | ||
email = str(jsonRequest.get('email')[0]) | ||
username = str(jsonRequest.get('username')[0]) | ||
password = str(jsonRequest.get('password')[0]) | ||
|
||
smtp = smtplib.SMTP('smtp.gmail.com', 587) | ||
smtp.ehlo() | ||
smtp.starttls() | ||
smtp.login(username, password) | ||
|
||
msg = MIMEText(text, "html") | ||
msg['Subject'] = subject | ||
|
||
smtp.sendmail(username, email, msg.as_string()) | ||
smtp.quit() | ||
|
||
response = Response("Email sent successfully", status=200) | ||
|
||
return response | ||
|
||
except Exception as e: | ||
error_message = str(e) | ||
response = Response("Failed to send email: " + error_message, status=500) | ||
|
||
return response | ||
|
||
if __name__ == '__main__': | ||
app.run('0.0.0.0', port=5000, debug=True) |
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,7 @@ | ||
#!/bin/bash | ||
|
||
# Docker 이미지 빌드 | ||
docker build -t flask-app:v1 . | ||
|
||
# Docker 컨테이너 실행 | ||
docker run -d -p 80:5000 flask-app:v1 |
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -148,4 +148,4 @@ private String fileWhiteList(String fileName) { | |
|
||
return caseInSensitiveFileName; | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -74,4 +74,4 @@ public ResponseEntity<?> deleteScore( | |
|
||
return ResponseEntity.ok(ApiUtils.success()); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -214,4 +214,4 @@ public int findMinScore(List<Score> scores) { | |
.min() | ||
.orElse(0); | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.