forked from c2siorg/b0bot
-
Notifications
You must be signed in to change notification settings - Fork 0
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
72 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,2 @@ | ||
.vscode | ||
*/__pycache__ |
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,20 @@ | ||
FROM python:3.8-bullseye | ||
|
||
# Set the working directory to /app | ||
WORKDIR /code | ||
|
||
# Copy the requirements file and install the dependencies | ||
COPY ./requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the source code into the container | ||
COPY ./src ./src | ||
|
||
# Expose port 80 to the outside world | ||
EXPOSE 80 | ||
|
||
# Start the Flask application | ||
# development mode | ||
CMD ["gunicorn", "-b", "0.0.0.0:80", "--log-level", "debug", "--reload", "src.app:app"] | ||
# production mode | ||
# CMD ["gunicorn", "-b", "0.0.0.0:80","src.app:app"] |
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,10 @@ | ||
services: | ||
app: | ||
build: . | ||
container_name: B0Bot-App | ||
command: gunicorn -b 0.0.0.0:80 --log-level debug --reload "src.app:app" # developement | ||
# command: gunicorn -b 0.0.0.0:80 --reload "src.app:app" # production | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- .:/code |
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,3 @@ | ||
Flask==2.2.3 | ||
Werkzeug==2.2.3 | ||
gunicorn==20.1.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from flask import Flask | ||
|
||
def create_app(): | ||
app = Flask(__name__) | ||
|
||
# set configuration variables here, e.g. | ||
|
||
|
||
# register blueprints and other components here, e.g. | ||
|
||
return app |
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,26 @@ | ||
from flask import Flask, jsonify | ||
from src import create_app | ||
|
||
app = create_app() | ||
|
||
@app.route('/') | ||
def home(): | ||
# send json response | ||
return jsonify( { | ||
'org': 'BugZero', | ||
'project': 'B0Bot' | ||
}) | ||
|
||
@app.route('/search/<query>') | ||
def search(query): | ||
# Code to search Twitter API for latest news on query | ||
news = "here is the news on " + query | ||
return jsonify( { | ||
'news': news | ||
}) | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) | ||
else: | ||
gunicorn_app = app |