Skip to content

Commit

Permalink
#103 Stablish Blueprint reference and update docker-compose image ref
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasdutraf committed Sep 25, 2019
1 parent 74171f1 commit 21b7f95
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 25 deletions.
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ FROM python:3.6.5-alpine


# set working directory
WORKDIR /usr/src/app
WORKDIR /app

# Install Dependencies
RUN apk update && \
apk add --virtual build-deps gcc python-dev musl-dev

# add and install requirements
COPY ./requirements.txt /usr/src/app/requirements.txt
# Dealing with requirements
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt

RUN pip install -r requirements.txt


# add app
COPY . /usr/src/app
# Coping project
COPY . /app


# run server
Expand Down
10 changes: 4 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ version: "3.6"

services:
pax-service:
build:
context: ./services/pax
dockerfile: Dockerfile
image: paxapp/pax-pax:latest
volumes:
- "./services/pax:/usr/src/app"
- ".:/app"
ports:
- 5001:5000
- 5003:5000
environment:
- FLASK_APP=project/__init
- FLASK_APP=project/__init__.py
7 changes: 5 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from project import create_app
from flask.cli import FlaskGroup
from project import app

# Config coverage report
app = create_app()
cli = FlaskGroup(app)


if __name__ == '__main__':
cli()
cli()
23 changes: 13 additions & 10 deletions project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import os
from flask import Flask, jsonify
from project.api.views import pax_blueprint


# instantiate the app
app = Flask(__name__)
def create_app(script_info=None):
# Instantiate the app
app = Flask(__name__)

# set config
app.config.from_object('project.config.DevelopmentConfig')
# new
# Set Configuration
app_settings = os.getenv('APP_SETTINGS')
app.config.from_object(app_settings)

# register blueprints
app.register_blueprint(pax_blueprint)

@app.route('/users/ping', methods=['GET'])
def ping_pong():
return jsonify({
'status': 'success',
'message': 'pong!'
})
return app
Empty file added project/api/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions project/api/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask import request, jsonify, Blueprint

pax_blueprint = Blueprint('pax', __name__)


@pax_blueprint.route('/pax/ping', methods=['GET'])
def ping_pong():
return jsonify({
'status': 'success',
'message': 'pong!'
})

0 comments on commit 21b7f95

Please sign in to comment.