Public Repository

Last pushed: 4 days ago
Short Description
Short description is empty for this repo.
Full Description

------------------------------- $ more Dockerfile
FROM python:2.7-slim
ADD . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/gunicorn", "-b", ":8080", "main:app"]

------------------------------- $ more requirements.txt
Flask==0.10.1
gunicorn==19.3.0
google-cloud-storage

------------------------------- $ more main.py

#!/usr/bin/python

from google.cloud import storage
import logging
import json
from flask import Flask, request, Response, abort, redirect, jsonify
import os
import pprint
import sys

import logging

app = Flask(name)

@app.route('/gcs')
def gcs():
r = []
try:
client = storage.Client()
for bucket in client.list_buckets():
r.append(bucket.name)
except Exception as e:
return Response(str(e),mimetype='text/plain')
return Response(json.dumps(r, sort_keys=True, indent=4), mimetype='application/json')

@app.route('/', methods = ['GET'])
def index():
logging.info("/ called")
return 'hello world', 200, {'Content-Type': 'text/plain; charset=utf-8'}

@app.route('/_ah/health')
def healthcheck():
return 'ok', 200, {'Content-Type': 'text/plain; charset=utf-8'}

if name == 'main':
app.run(host='0.0.0.0', port=8080, debug=True)

Docker Pull Command
Owner
salrashid123