Prepare for docker
This commit is contained in:
parent
76fe84af98
commit
68dffaba3c
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM python
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY ./src ./
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD "python" "./app.py"
|
@ -86,7 +86,9 @@ class addFile(Resource):
|
||||
if client.addMeme(fileContents=file,
|
||||
name=fileName,
|
||||
tags=tags):
|
||||
return {"message" : "sucess"}
|
||||
return {"message" : "success", "sucess" : True}
|
||||
else:
|
||||
return {"message" : "failure", "success" : False}, 500
|
||||
|
||||
|
||||
|
||||
|
@ -8,10 +8,11 @@ import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
isDebug = True
|
||||
isDebug = bool(os.environ.get('DEBUG', False))
|
||||
port = int(os.environ.get('PORT', 5000))
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
api.init_app(app)
|
||||
|
||||
app.run(debug=isDebug)
|
||||
app.run(debug=isDebug, host='0.0.0.0', port=port)
|
||||
|
@ -87,6 +87,7 @@ class Client:
|
||||
self.client = client
|
||||
else:
|
||||
raise Exception("Improper object passed for client!")
|
||||
self.getCurrentMemeList(force=True)
|
||||
|
||||
def getCurrentMemeList(self, force=False):
|
||||
"""
|
||||
@ -135,8 +136,8 @@ class Client:
|
||||
tags=tags,
|
||||
part_size=10*1024*1024)
|
||||
if result.etag in self.memesToMd5:
|
||||
logger.info('Uploaded meme named ' + name + ' already exists')
|
||||
client.remove_object(bucket_name=S3_BUCKET,
|
||||
logging.info('Uploaded meme named ' + name + ' already exists')
|
||||
self.client.remove_object(bucket_name=S3_BUCKET,
|
||||
object_name=name)
|
||||
return False
|
||||
else:
|
||||
|
Reference in New Issue
Block a user